Closed wizzard0 closed 9 years ago
we expect define([], cb) format, but not others
define((r,e,m){}):
return define = function(names, func) {
var needREM;
if(!func) {
console.log("no-names hack");
func = names;
names = [];
needREM = true;
}
var deps, name;
if(needREM){
var m={};
m.exports={};
deps = [void 0,m.exports,m];
func.apply(this["this"], deps);
return this.result = m.exports;
}else{
return deps = function() {
var _i, _len, _results;
for (_results = [], _i = 0, _len = names.length; _len > _i; _i++) name = names[_i], _results.push(this.deps[name]);
return _results
}.call(this), this.result = func.apply(this["this"], deps)
}
}, define.bind(this)