refactor(module autojs): package com.stardust.autojs.runtime.inputevent
add: module engines
This commit is contained in:
@@ -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