define class methods instead of assigning them - fixes #454

This commit is contained in:
Sebastian McKenzie
2015-01-12 11:44:23 +11:00
parent d093dc8231
commit 545c8c3adb
8 changed files with 136 additions and 59 deletions

View File

@@ -1,11 +1,23 @@
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var Test = (function () {
var Test = function Test() {};
Test.prototype.test = function () {
return 5 + 5;
};
_prototypeProperties(Test, null, {
test: {
value: function () {
return 5 + 5;
},
writable: true,
enumerable: true,
configurable: true
}
});
return Test;
})();