Debug模块提供了一些调试工具,比如诊断内存泄露,获取一个Error的详细堆栈等。
#$debug.dumpHprof(file)
file {string} dump文件路径
将整个脚本进程的内存dump到文件file中。
当你发现Auto.js Pro占用内存很高时,你可以运行这个函数来dump整个内存并反馈给开发者,开发者可以通过内存dum...
该模块用于管理定时任务,用于在某些时间或某些事件触发时自动运行脚本。正如Auto.js Pro内置的定时任务功能一样,打包的脚本也可以使用这些函数来创建定时任务。
添加定时任务时建议加上申请忽略电池优化的代码,防止被Android限制在后台运行。参见电池管理 - PowerManageropen in new window。
if (!...
Rhino提供了非常方便地和Java交互的能力。
#liveConnect:与JavaScript的Java通信
Rhino允许您从JavaScript中创建Java类并调用Java方法。例如:
let builder = new java.lang.Builder();
builder.append('test');
builder.append(1);
console.log(builder.toString());
#访问JavaBean属性
Jav...
用户界面: UI视图: Viewattr(name, value)attr(name)whidgravitylayout_gravitymarginmarginLeftmarginRightmarginTopmarginBottompaddingpaddingLeftpaddingRightpaddingToppaddingBottombgalphaforegroundminHeightminWidthvisibilityrotationtransformPivotXtransformPivotYstyle文本控件: texttexttextCo...
TimerssetInterval(callback, delay[, ...args])setTimeout(callback, delay[, ...args])setImmediate(callback[, ...args])clearInterval(id)clearTimeout(id)clearImmediate(id)
Timers#
Stability: 2 - Stable
timers 模块暴露了一个全局的 API,用于在某个未来时间段调用调度函数。 因为定时器...
Threadsthreads.start(action)threads.shutDownAll()threads.currentThread()threads.disposable()threads.atomic([initialValue])threads.lock()ThreadThread.interrupt()Thread.join([timeout])isAlive()waitFor()Thread.setTimeout(callback, delay[, ...args])Thread.setInterval(callback, delay[, ...a...
Storagesstorages.create(name)storages.remove(name)StoragesStorage.get(key[, defaultValue])Storage.put(key, value)Storage.remove(key)Storage.contains(key)Storage.clear()
Storages#
Stability: 2 - Stable
storages模块提供了保存简单数据、用户配置等的支持。保存的数据除非应用被卸载或...
shell函数shell(cmd[, root])Shellnew Shell(root)Shell.exec(cmd)Shell.exit()Shell.exitAndWaitFor()Shell.setCallback(callback)附录: shell命令简介am命令start [options] intentstartservice [options] intentforce-stop packagekill [options] packagekill-allbroadcast [options] intentinstrument [o...
Sensorssensors.register(sensorName[, delay])sensors.unregister(emitter)sensors.unregisterAll()sensors.ignoresUnsupportedSensor事件: 'unsupported_sensor'SensorEventEmitter事件: 'change'事件: 'accuracy_change'
Sensors#
Stability: 2 - Stable
sensors模块提供了获取手机上的传感器的...
module (模块)
module (模块)#
Stability: 2 - Stable
Auto.js 有一个简单的模块加载系统。 在 Auto.js 中,文件和模块是一一对应的(每个文件被视为一个独立的模块)。
例子,假设有一个名为 foo.js 的文件:
var circle = require('circle.js');
console.log("半径为 4 的圆的面积是 %d", c...