constructInstance: function()

in xhpjs.js [70:90]


  constructInstance: function(elementId) {
    var data = this.instanceData[elementId];
    var moduleName = data[1];
    var args = this.mapArguments(data[2]);

    var module = window[moduleName] ? window[moduleName] : require(moduleName);

    var XHPJSInstance = function(args) {
      return module.apply(this, args);
    }

    XHPJSInstance.prototype = module.prototype;

    var instance = new XHPJSInstance(args);

    // Handy for debugging :)
    instance.__xhpJSModule = moduleName;
    instance.__xhpJSElement = this.getElement(elementId);

    this.instances[elementId] = instance;
  }