add timers modules
This commit is contained in:
@@ -13,6 +13,15 @@ if(__engine_name__ == "rhino"){
|
||||
}
|
||||
}
|
||||
|
||||
__runtime__.bridges.setFunctionCaller(function(func, target, args){
|
||||
var arr = [];
|
||||
var len = args.length;
|
||||
for(var i = 0; i < len; i++){
|
||||
arr.push(args[i]);
|
||||
}
|
||||
return func.apply(target, arr);
|
||||
});
|
||||
|
||||
var __that__ = this;
|
||||
|
||||
var __asGlobal__ = function(obj, functions){
|
||||
@@ -27,7 +36,7 @@ require("__general__")(__runtime__, this);
|
||||
|
||||
|
||||
(function(scope){
|
||||
var modules = ['app', 'automator', 'console', 'dialogs', 'io', 'selector', 'shell', 'web', 'ui', "images", "events"];
|
||||
var modules = ['app', 'automator', 'console', 'dialogs', 'io', 'selector', 'shell', 'web', 'ui', "images", "timers", "events"];
|
||||
var len = modules.length;
|
||||
for(var i = 0; i < len; i++) {
|
||||
var m = modules[i];
|
||||
|
||||
@@ -2,23 +2,6 @@
|
||||
module.exports = function(__runtime__, scope){
|
||||
var events = Object.create(__runtime__.events);
|
||||
|
||||
var caller = function(func, args){
|
||||
var arr = [];
|
||||
var len = args.length;
|
||||
for(var i = 0; i < len; i++){
|
||||
arr.push(args[i]);
|
||||
}
|
||||
return func.apply(null, arr);
|
||||
};
|
||||
|
||||
events.setFunctionCaller(caller);
|
||||
|
||||
events.emitter = function(){
|
||||
var e = new com.stardust.autojs.runtime.api.EventEmitter();
|
||||
e.setFunctionCaller(caller);
|
||||
return e;
|
||||
}
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,12 @@ module.exports = function(__runtime__, scope){
|
||||
return !isStopped();
|
||||
}
|
||||
|
||||
scope.stop = function(){
|
||||
__runtime__.stop();
|
||||
scope.exit = function(){
|
||||
__runtime__.exit();
|
||||
}
|
||||
|
||||
scope.stop = scope.exit;
|
||||
|
||||
scope.setClip = function(text){
|
||||
__runtime__.setClip(text);
|
||||
}
|
||||
|
||||
9
autojs/src/main/assets/modules/__timers__.js
Normal file
9
autojs/src/main/assets/modules/__timers__.js
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
module.exports = function(__runtime__, scope){
|
||||
var timers = Object.create(__runtime__.timers);
|
||||
|
||||
scope.__asGlobal__(timers, ['loop', 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'setImmediate', 'clearImmediate']);
|
||||
|
||||
return timers;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user