diff --git a/app/release/output.json b/app/release/output.json index 3126ad05..fa8e30fd 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":231},"path":"release-3.0.0 Alpha31.apk","properties":{"packageId":"com.stardust.scriptdroid","split":"","minSdkVersion":"17"}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":232},"path":"release-3.0.0 Alpha32.apk","properties":{"packageId":"com.stardust.scriptdroid","split":"","minSdkVersion":"17"}}] \ No newline at end of file diff --git a/app/src/main/assets/docs/storages.html b/app/src/main/assets/docs/storages.html new file mode 100644 index 00000000..e2017a30 --- /dev/null +++ b/app/src/main/assets/docs/storages.html @@ -0,0 +1,149 @@ + + + + + Storages | Auto.js 3.0.0 文档 + + + + + + +
+
+ + +
+ + +
+ + + +
+ +
+
+

Auto.js 3.0.0 文档

+
+

+ 索引 | + 查看全部 +

+
+
+
+ + + +
+

Storages#

+
Stability: 2 - Stable

storages模块提供了保存简单数据、用户配置等的支持。保存的数据除非应用被卸载或者被主动删除,否则会一直保留。

+

storages支持number, boolean, string等数据类型以及把Object, ArrayJSON.stringify序列化存取。

+

storages保存的数据在脚本之间是共享的,任何脚本只要知道storage名称便可以获取到相应的数据,因此它不能用于敏感数据的储存。 +storages无法像Web开发中LocalStorage一样提供根据域名独立的存储,因为脚本的路径随时可能改变。

+

storages.create(name)#

+
+

创建一个本地存储并返回一个Storage对象。不同名称的本地存储的数据是隔开的,而相同名称的本地存储的数据是共享的。

+

例如在一个脚本中,创建名称为ABC的存储并存入a=123:

+
var storage = stroages.create("ABC");
+storage.put("a", 123);
+

而在另一个脚本中是可以获取到ABC以及a的值的:

+
var storage = storages.create("ABC");
+log("a = " + storage.get("a"));
+

因此,本地存储的名称比较重要,尽量使用含有域名、作者邮箱等信息的名称来避免冲突,例如:

+
var storage = storages.create("2732014414@qq.com:ABC");
+

storages.remove(name)#

+
+

删除一个本地存储以及他的全部数据。如果该存储不存在,返回false;否则返回true。

+

Storages#

+

Storage.get(key[, defaultValue])#

+
    +
  • key <string> 键值
  • +
  • defaultValue <any> 可选,默认值
  • +
+

从本地存储中取出键值为key的数据并返回。

+

如果该存储中不包含该数据,这时若指定了默认值参数则返回默认值,否则返回undefined。

+

返回的数据可能是任意数据类型,这取决于使用Storage.put保存该键值的数据时的数据类型。

+

Storage.put(key, value)#

+
    +
  • key <string> 键值
  • +
  • value <any>
  • +
+

把值value保存到本地存储中。value可以是undefined以外的任意数据类型。如果value为undefined则抛出TypeError。

+

存储的过程实际上是使用JSON.stringify把value转换为字符串再保存,因此value必须是可JSON化的才能被接受。

+

Storage.remove(key)#

+
+

移除键值为key的数据。不返回任何值。

+

Storage.contains(key)#

+
+

返回该本地存储是否包含键值为key的数据。是则返回true,否则返回false。

+

Storage.clear()#

+

移除该本地存储的所有数据。不返回任何值。

+ +
+
+
+ + + + + + \ No newline at end of file diff --git a/app/src/main/assets/docs/threads.html b/app/src/main/assets/docs/threads.html new file mode 100644 index 00000000..a27ef310 --- /dev/null +++ b/app/src/main/assets/docs/threads.html @@ -0,0 +1,106 @@ + + + + + Threads | Auto.js 3.0.0 文档 + + + + + + +
+
+ + +
+ + +
+ + + +
+ +
+
+

Auto.js 3.0.0 文档

+
+

+ 索引 | + 查看全部 +

+
+
+
+ +
+

目录

+ + +
+ +
+

Threads#

+
Stability: 1 - Experiment

threads模块提供了多线程支持。可以启动新线程来运行脚本。新线程会在脚本停止时也自动停止。

+

但是,在新线程中暂时不能使用timers模块的函数,包括setTimeout, setInterval等。而且目前在新线程调用exit()函数时只会退出当前线程。

+

threads.start(action)#

+
    +
  • action <Function> 要在新线程执行的函数
  • +
+

启动一个新线程并执行action。

+

例如:

+
threads.start(function(){
+    while(true){
+        log("线程2");
+    }
+});
+while(true){
+    log("线程1");
+}
+
+
+
+
+ + + + + + \ No newline at end of file