ms-types 0.12.5 → 0.12.6

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 +11 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-types",
3
- "version": "0.12.5",
3
+ "version": "0.12.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./types/index.d.ts",
package/types/web.d.ts CHANGED
@@ -46,14 +46,18 @@ declare namespace ms {
46
46
 
47
47
  /**
48
48
  * 在脚本引擎里执行函数
49
- * 函数在脚本引擎里执行,可以直接调用引擎的全局方法,例如 click、sleep、time。
50
- * 网页变量通过函数后面的参数传进去。函数里直接写网页变量名读不到。
51
- * 每次调用单独执行,和 startTask 启动的脚本不共享变量。
52
- * 函数同步执行。没有返回值时得到 null。参数和返回值需要能用 JSON 表示。执行失败或函数抛错时 Promise 拒绝。
53
- * @param func 要在脚本引擎里执行的函数,参数对应后面传入的值
54
- * @param args 传给函数的网页变量。可以是数字、字符串、布尔、数组或普通对象
49
+ * 可以直接调用引擎的全局方法,例如 click、sleep、time。
50
+ * 网页变量写在函数后面,按顺序传进函数参数。函数里写网页上的变量名读不到。
51
+ * 参数和返回值只能是数字、字符串、布尔、null、数组或普通对象。参数里的函数会变成 null,对象里的函数字段会被丢掉,数组里的 undefined 会变成 null。带循环引用的对象无法传递,调用会拒绝。
52
+ * 没有 return、返回 null 或 undefined 时得到 null。抛错、未授权或引擎无法执行时 Promise 拒绝。
53
+ * 每次调用单独执行,和 startTask 正在运行的脚本不共享变量。函数同步执行,不要写成 async。
54
+ * @param func 在脚本引擎里执行的函数。参数按顺序接收后面传入的值
55
+ * @param args 网页上的变量,按顺序传给函数
55
56
  * @returns 函数的返回值
56
- * @example ms.runScript((x, y) => { click(x, y); return time(); }, 200, 400)
57
+ * @example
58
+ * const x = 200;
59
+ * const y = 400;
60
+ * ms.runScript((x, y) => { click(x, y); return time(); }, x, y);
57
61
  */
58
62
  function runScript(
59
63
  func: (...args: any[]) => any,