utools-api-types 5.2.0 → 6.0.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utools-api-types",
3
- "version": "5.2.0",
3
+ "version": "6.0.0",
4
4
  "description": "TypeScript definitions for uTools API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -150,7 +150,7 @@
150
150
  },
151
151
  "mainHide":{
152
152
  "type":"boolean",
153
- "description": "设置为 `true` 时,启动对应的 `feature` 不会弹出主面板"
153
+ "description": "设置为 `true` 时,启动对应的 `feature` 不主动弹出主面板"
154
154
  }
155
155
  }
156
156
  }
package/utools.api.d.ts CHANGED
@@ -52,7 +52,7 @@ interface UBrowser {
52
52
  /**
53
53
  * 模拟设备
54
54
  */
55
- device(arg: ('iPhone 11' | 'iPhone X' | 'iPad' | 'iPhone 6/7/8 Plus' | 'iPhone 6/7/8' | 'iPhone 5/SE' | 'HUAWEI Mate10' | 'HUAWEI Mate20' | 'HUAWEI Mate30' | 'HUAWEI Mate30 Pro') | { size: { width: number, height: number }, useragent: string }): this;
55
+ device(arg: { size: { width: number, height: number }, useragent: string }): this;
56
56
  /**
57
57
  * 获取 cookie
58
58
  * @param name 为空获取全部cookie
@@ -104,7 +104,7 @@ interface UBrowser {
104
104
  */
105
105
  wait<T extends any[]>(func: (...params: T) => boolean, timeout?: number, ...params: T): this;
106
106
  /**
107
- * 当元素存在时执行直到碰到 end
107
+ * 当元素存在时执行,直到碰到 end
108
108
  * @param selector DOM元素
109
109
  */
110
110
  when(selector: string): this;
@@ -164,6 +164,10 @@ interface UBrowser {
164
164
  * 下载文件
165
165
  */
166
166
  download(url: string, savePath?: string): this;
167
+ /**
168
+ * 下载文件
169
+ */
170
+ download(func: (...params: any[]) => string, savePath: string | null, ...params: any[]): this;
167
171
  /**
168
172
  * 启动一个 ubrowser 运行
169
173
  * 当运行结束后,窗口如果为隐藏状态将自动销毁窗口
@@ -237,10 +241,6 @@ interface PluginFeature {
237
241
  type: 'img' | 'files' | 'regex' | 'over' | 'window',
238
242
  label: string
239
243
  })[]
240
- /**
241
- * @version >= 5.2.0
242
- * 设置为 `true` 时,启动对应的 `feature` 不会弹出主面板
243
- */
244
244
  mainHide?: boolean
245
245
  mainPush?: boolean
246
246
  }
@@ -737,6 +737,45 @@ interface UToolsApi {
737
737
  removeItem(key: string): void;
738
738
  };
739
739
 
740
+ dbCryptoStorage: {
741
+ /**
742
+ * 键值对加密存储,如果键名存在,则更新其对应的值
743
+ * @param key 键名(同时为文档ID)
744
+ * @param value 键值
745
+ */
746
+ setItem(key: string, value: any): void;
747
+ /**
748
+ * 获取键名对应的值
749
+ */
750
+ getItem<T = any>(key: string): T;
751
+ /**
752
+ * 删除键值对(删除文档)
753
+ */
754
+ removeItem(key: string): void;
755
+ };
756
+
757
+ team: {
758
+ /**
759
+ * 获取团队信息
760
+ */
761
+ info(): {
762
+ teamId: string,
763
+ teamName: string,
764
+ teamLogo: string,
765
+ userId: string,
766
+ userName: string,
767
+ userAvatar: string
768
+ };
769
+ /**
770
+ * 获取团队版预设键名对应的值
771
+ */
772
+ preset<T = any>(key: string): T;
773
+ /**
774
+ * 获取团队版预设的所有数据
775
+ */
776
+ allPresets(): Promise<{ key: string, value: any }[]>;
777
+ }
778
+
740
779
  ubrowser: UBrowser;
741
780
  }
742
781