code: function() {
          if (!(this instanceof clazz)) {
            throw new Error("Use new keyword to create a new instance or call/apply class with right scope");
          }
          Class.onBeforeInstantiation && Class.onBeforeInstantiation(this);
          
          // remember the current super property
          var temp = this.__super__;
          // set the right super class prototype
          this.__super__ = superClass;
  
          // call the right constructor
          if (constructor) {
            constructor.apply(this, arguments);
          } else if (superClass) {
            superClass.apply(this, arguments);
          }
          // reset the current super property
          this.__super__ = temp;
          Class.onAfterInstantiation && Class.onAfterInstantiation(this);
        }
docs: use clazz instead of class as it is a reserved keyword