ms-types 0.12.4 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types/web.d.ts +10 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-types",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./types/index.d.ts",
package/types/web.d.ts CHANGED
@@ -47,13 +47,18 @@ declare namespace ms {
47
47
  /**
48
48
  * 在脚本引擎里执行函数
49
49
  * 函数在脚本引擎里执行,可以直接调用引擎的全局方法,例如 click、sleep、time。
50
- * 网页里的变量不在这次执行里。每次调用单独执行,和 startTask 启动的脚本不共享变量。
51
- * 函数同步执行。没有返回值时得到 null。返回值需要能用 JSON 表示。执行失败或函数抛错时 Promise 拒绝。
52
- * @param func 要在脚本引擎里执行的函数
50
+ * 网页变量通过函数后面的参数传进去。函数里直接写网页变量名读不到。
51
+ * 每次调用单独执行,和 startTask 启动的脚本不共享变量。
52
+ * 函数同步执行。没有返回值时得到 null。参数和返回值需要能用 JSON 表示。执行失败或函数抛错时 Promise 拒绝。
53
+ * @param func 要在脚本引擎里执行的函数,参数对应后面传入的值
54
+ * @param args 传给函数的网页变量。可以是数字、字符串、布尔、数组或普通对象
53
55
  * @returns 函数的返回值
54
- * @example ms.runScript(() => { click(200, 400); return time(); })
56
+ * @example ms.runScript((x, y) => { click(x, y); return time(); }, 200, 400)
55
57
  */
56
- function runScript(func: () => any): Promise<any>;
58
+ function runScript(
59
+ func: (...args: any[]) => any,
60
+ ...args: any[]
61
+ ): Promise<any>;
57
62
 
58
63
  /**
59
64
  * 设置配置项