refactor(module autojs): package com.stardust.autojs.runtime.inputevent
add: module engines
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
43
autojs/src/main/assets/modules/__engines__.js
Normal file
43
autojs/src/main/assets/modules/__engines__.js
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user