shortcut for specifying constructor properties?
Say I have a constructor, and some dynamic and static methods (direct
properties of the constructor):
function MyConstructor() {this.foo = 'bar';}
MyConstructor.prototype = {
dynamic1 : function () {return this.foo;}
,dynamic2 : function () {return this.foo;}
};
MyConstructor.static1 = function () {return 1;};
MyConstructor.static2 = function () {return 2;};
Is there a shortcut to specifying the static methods, maybe with the
constructor itself (or all of it)? Something like this (but that works):
MyConstructor = {
__constructor__ : {this.foo = 'bar;}
,static1 : function () {return 1;};
,static2 : function () {return 2;};
,prototype : {
dynamic1 : function () {return this.foo;}
,dynamic2 : function () {return this.foo;}
}
};
--
Steve Clay
http://mrclay.org/