refactor(module autojs): package com.stardust.autojs.runtime.inputevent

add: module engines
This commit is contained in:
hyb1996
2017-08-04 15:19:57 +08:00
parent f2c1015470
commit 19dac12614
37 changed files with 904 additions and 562 deletions

View File

@@ -37,7 +37,7 @@ require("__general__")(__runtime__, this);
(function(scope){
var modules = ['app', 'automator', 'console', 'dialogs', 'io', 'selector', 'shell', 'web', 'ui', "images", "timers", "events"];
var modules = ['app', 'automator', 'console', 'dialogs', 'io', 'selector', 'shell', 'web', 'ui', "images", "timers", "events", "engines"];
var len = modules.length;
for(var i = 0; i < len; i++) {
var m = modules[i];

View File

@@ -40,7 +40,7 @@ module.exports = function(__runtime__, scope){
app.launch = app.launchPackage;
scope.__asGlobal__(app, ['launchPackage', 'launch', 'launchApp', 'getPackageName', 'openAppSetting']);
scope.__asGlobal__(app, ['launchPackage', 'launch', 'launchApp', 'getPackageName', 'getAppName', 'openAppSetting']);
return app;
}

View File

@@ -0,0 +1,43 @@
module.exports = function(__runtime__, scope){
var rtEngines = __runtime__.engines;
var engines = {};
engines.execScript = function(name, script, config){
config = fillConfig(config);
return rtEngines.execScript(name, script, config);
}
engines.execScriptFile = function(path, config){
config = fillConfig(config);
return rtEngines.execScriptFile(path, config);
}
engines.execAutoFile = function(path, config){
config = fillConfig(config);
return rtEngines.execAutoFile(path, config);
}
engines.stopAll = rtEngines.stopAll.bind(rtEngines);
engines.stopAllAndToast = rtEngines.stopAllAndToast.bind(rtEngines);
function fillConfig(c){
var config = new com.stardust.autojs.execution.ExecutionConfig();
c = c || {};
if(c.path){
if(typeof(c.path) == "string"){
config.path([c.path]);
}else{
config.path(c.path);
}
}
c.delay = c.delay || 0;
c.interval = c.interval || 0;
c.loopTimes = c.loopTimes || 1;
config.loop(c.delay, c.loopTimes, c.interval);
return config;
}
return engines;
}