docs: events, automator

This commit is contained in:
hyb1996
2018-02-27 17:59:12 +08:00
parent ce515e58e0
commit 3de96662c6
7 changed files with 87 additions and 16 deletions

View File

@@ -111,13 +111,8 @@ module.exports = function(runtime, global){
global.auto = function(mode){
if(mode){
if(typeof(mode) !== "string"){
throw new TypeError("mode should be a string");
}
mode = modes[mode.toLowerCase()];
global.auto.setMode(mode);
}
mode = mode || 0;
runtime.accessibilityBridge.setMode(mode);
runtime.accessibilityBridge.ensureServiceEnabled();
}
@@ -125,6 +120,14 @@ module.exports = function(runtime, global){
runtime.accessibilityBridge.waitForServiceEnabled();
}
global.auto.setMode = function(mode){
if(typeof(mode) !== "string"){
throw new TypeError("mode should be a string");
}
mode = modes[mode.toLowerCase()] || 0;
runtime.accessibilityBridge.setMode(mode);
}
global.__asGlobal__(runtime.automator, ['back', 'home', 'powerDialog', 'notifications', 'quickSettings', 'recents', 'splitScreen']);
global.__asGlobal__(automator, ['click', 'longClick', 'press', 'swipe', 'gesture', 'gestures', 'gestureAsync', 'gesturesAsync', 'scrollDown', 'scrollUp', 'input', 'setText']);