diff options
Diffstat (limited to 'js/src/Ice/Class.js')
-rw-r--r-- | js/src/Ice/Class.js | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/js/src/Ice/Class.js b/js/src/Ice/Class.js index 1e1778fb71f..2b925580cdb 100644 --- a/js/src/Ice/Class.js +++ b/js/src/Ice/Class.js @@ -7,52 +7,49 @@ // // ********************************************************************** -(function(global){ - var Ice = global.Ice || {}; +var Ice = require("../Ice/ModuleRegistry").Ice; + +Ice.Class = function() +{ + var base; + var desc; + var constructor; - var Class = function() + if(arguments.length == 1) { - var base; - var desc; - var constructor; - - if(arguments.length == 1) - { - desc = arguments[0]; - } - else if(arguments.length == 2) - { - base = arguments[0]; - desc = arguments[1]; - } + desc = arguments[0]; + } + else if(arguments.length == 2) + { + base = arguments[0]; + desc = arguments[1]; + } - if(desc !== undefined) + if(desc !== undefined) + { + constructor = desc.__init__; + if(constructor) { - constructor = desc.__init__; - if(constructor) - { - delete desc.__init__; - } + delete desc.__init__; } - - var o = constructor || function(){}; + } + + var o = constructor || function(){}; - if(base !== undefined) - { - o.prototype = new base(); - o.prototype.constructor = o; - } + if(base !== undefined) + { + o.prototype = new base(); + o.prototype.constructor = o; + } - if(desc !== undefined) + if(desc !== undefined) + { + for(var key in desc) { - for(var key in desc) - { - o.prototype[key] = desc[key]; - } + o.prototype[key] = desc[key]; } - return o; - }; - - Ice.Class = Class; - global.Ice = Ice; -}(typeof (global) === "undefined" ? window : global)); + } + return o; +}; + +module.exports.Ice = Ice; |