Riferimento: http://ejohn.org/blog/simple-class-instantiation/John Resig di classe e "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);
};
}
mi chiedevo, se ce ne sono ECMAScript 5 modo compatibile per implementare la stessa funzionalità. Il problema è che l'accesso a arguments.callee
è deprecato in modalità rigorosa.