I have this javascript:
var Type = function(name) { this.name = name; }; var t = new Type();
Now I want to add this:
var wrap = function(cls) {
So, I can do:
wrap(Type); var t = new Type(); assertEquals(1, t.extraField);
[EDIT] I would like to have an instance property, not a class property (static / shared).
The code executed in the wrapper function should work as if I had embedded it in a real constructor.
Type must not change.
Aaron digulla
source share