ms-types 0.0.14 → 0.0.15

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/ui.d.ts +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-types",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/types/ui.d.ts CHANGED
@@ -3,14 +3,17 @@
3
3
  * @param name 函数名称
4
4
  * @param func 函数
5
5
  */
6
- declare function registerUIFunc(name: string, func: (data: any) => void): void;
6
+ declare function registerUIFunc(
7
+ name: string,
8
+ func: (data: Record<string, any>) => void
9
+ ): void;
7
10
 
8
11
  /**
9
12
  * 发送事件 网页页面使用 给主进程发送事件
10
13
  * @param event 事件名称
11
14
  * @param data 事件参数
12
15
  */
13
- declare function emitEvent(event: string, data: any): void;
16
+ declare function emitEvent(event: string, data: Record<string, any>): void;
14
17
 
15
18
  /**
16
19
  * UI模块 包含加载html文件、调用js方法等功能
@@ -34,9 +37,11 @@ declare namespace ui {
34
37
  * @param key 方法名
35
38
  * @param data 方法参数
36
39
  * @example
37
- * webview.call("jsMethod", "hello world")
40
+ * webview.call("jsMethod", {
41
+ * name: "magicscript",
42
+ * })
38
43
  */
39
- call(key: string, data: any): void;
44
+ call(key: string, data: Record<string, any>): void;
40
45
  }
41
46
  /**
42
47
  * 创建WebView
@@ -58,10 +63,12 @@ declare namespace ui {
58
63
  * }
59
64
  * })
60
65
  * webview.show()
61
- * webview.call("jsMethod", "hello world")
66
+ * webview.call("jsMethod", {
67
+ * name: "magicscript",
68
+ * })
62
69
  */
63
70
  function newWebView(
64
71
  file: string,
65
- onEvent: (event: string, data: any) => void
72
+ onEvent: (event: string, data: string | Record<string, any>) => void
66
73
  ): WebView;
67
74
  }