referencyjny: http://ejohn.org/blog/simple-class-instantiation/Johna Resig Prosta klasa instancji i „use strict”
// makeClass - By John Resig (MIT Licensed)
function makeClass(){
return function(args){
if (this instanceof arguments.callee) {
if (typeof this.init == "function")
this.init.apply(this, args.callee ? args : arguments);
} else
return new arguments.callee(arguments);
};
}
Zastanawiałem się, czy są jakieś ECMAScript 5 sposób zgodny wdrożyć taką samą funkcjonalność. Problem polega na tym, że uzyskanie dostępu do arguments.callee
jest przestarzałe w trybie ścisłym.