modularize init script

This commit is contained in:
hyb1996
2017-05-09 15:47:31 +08:00
parent 08654b8f90
commit 956f064737
28 changed files with 451 additions and 667 deletions

View File

@@ -0,0 +1,36 @@
module.exports = function(__runtime__, scope){
var __selector__ = __runtime__.selector(scope.__engine__);
var __obj__ = new java.lang.Object();
for(var method in __selector__){
if(!__obj__[method] && !scope[method]){
scope[method] = (function(method) {
return function(){
var s = selector();
//这里不知道怎么写。尴尬。只能写成这样。
if(arguments.length == 0){
return s[method]();
}else if(arguments.length == 1){
return s[method](arguments[0]);
}else if(arguments.length == 2){
return s[method](arguments[0], arguments[1]);
}else if(arguments.length == 3){
return s[method](arguments[0], arguments[1], arguments[2]);
}else if(arguments.length == 4){
return s[method](arguments[0], arguments[1], arguments[2], arguments[3]);
}else{
return s[method].call(s, Array.prototype.slice.call(arguments));
}
};
})(method);
}
}
return function(){
return __runtime__.selector(scope.__engine__);
};
}