utools-api-types 2.0.6 → 2.6.3

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/utools.api.d.ts +65 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utools-api-types",
3
- "version": "2.0.6",
3
+ "version": "2.6.3",
4
4
  "description": "TypeScript definitions for uTools API",
5
5
  "repository": {
6
6
  "type": "git",
package/utools.api.d.ts CHANGED
@@ -5,12 +5,11 @@ interface UBrowser {
5
5
  useragent(userAgent: string): this;
6
6
  /**
7
7
  * 前往
8
+ * @param url 链接地址,支持 http 或 file 协议
9
+ * @param headers 请求头参数
10
+ * @param timeout 加载超时,默认 60000 ms(60秒)
8
11
  */
9
- goto(url: string, headers?: { Referer: string, userAgent: string }): this;
10
- /**
11
- * 显示Markdown
12
- */
13
- goto(mdText: string, title?: string): this;
12
+ goto(url: string, headers?: { Referer: string, userAgent: string }, timeout?: number): this;
14
13
  /**
15
14
  * 页面大小
16
15
  */
@@ -92,13 +91,13 @@ interface UBrowser {
92
91
  /**
93
92
  * 等待元素出现
94
93
  * @param selector DOM元素
95
- * @param timeout 超时 默认10000 ms(10秒)
94
+ * @param timeout 超时 默认60000 ms(60秒)
96
95
  */
97
96
  wait(selector: string, timeout?: number): this;
98
97
  /**
99
98
  * 等待 JS函数 执行返回 true
100
99
  * @param func 执行的JS函数
101
- * @param timeout 超时 默认10000 ms(10秒)
100
+ * @param timeout 超时 默认60000 ms(60秒)
102
101
  * @param params 传到 func 中的参数
103
102
  */
104
103
  wait(func: (...params: any[]) => boolean, timeout?: number, ...params: any[]): this;
@@ -166,6 +165,7 @@ interface UBrowser {
166
165
  run(ubrowserId: number): Promise<any[]>;
167
166
  /**
168
167
  * 启动一个 ubrowser 运行
168
+ * 当运行结束后,窗口如果为隐藏状态将自动销毁窗口
169
169
  * @param options
170
170
  */
171
171
  run(options: {
@@ -224,10 +224,6 @@ interface DbReturn {
224
224
  }
225
225
 
226
226
  interface UToolsApi {
227
- /**
228
- * 插件装配初始化完成触发
229
- */
230
- onPluginReady(callback: () => void): void;
231
227
  /**
232
228
  * 插件进入时触发
233
229
  */
@@ -405,23 +401,6 @@ interface UToolsApi {
405
401
  properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>,
406
402
  securityScopedBookmarks?: boolean
407
403
  }): (string) | (undefined);
408
- /**
409
- * 弹出消息框
410
- */
411
- showMessageBox(options: {
412
- type?: string,
413
- buttons?: string[],
414
- defaultId?: number,
415
- title?: string,
416
- message: string,
417
- detail?: string,
418
- checkboxLabel?: string,
419
- checkboxChecked?: boolean,
420
- icon?: string,
421
- cancelId?: number,
422
- noLink?: boolean,
423
- normalizeAccessKeys?: boolean
424
- }): number;
425
404
  /**
426
405
  * 插件页面中查找
427
406
  */
@@ -548,6 +527,14 @@ interface UToolsApi {
548
527
  * 获取矩形所在的显示器
549
528
  */
550
529
  getDisplayMatching(rect: { x: number, y: number, width: number, height: number }): Display;
530
+ /**
531
+ * 录屏源
532
+ */
533
+ desktopCaptureSources(options: { types: string[], thumbnailSize?: { width: number, height: number }, fetchWindowIcons?: boolean }):Promise<{appIcon: {}, display_id: string, id: string, name: string, thumbnail: {} }>;
534
+ /**
535
+ * 是否开发中
536
+ */
537
+ isDev(): boolean;
551
538
  /**
552
539
  * 是否 MacOs 操作系统
553
540
  */
@@ -599,6 +586,56 @@ interface UToolsApi {
599
586
  * @param docId 文档ID
600
587
  */
601
588
  getAttachmentType(docId: string): string | null;
589
+ /**
590
+ * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1:复制中)
591
+ */
592
+ replicateStateFromCloud(): null | 0 | 1;
593
+ /**
594
+ * 异步
595
+ */
596
+ promises: {
597
+ /**
598
+ * 创建/更新文档
599
+ */
600
+ put(doc: DbDoc): Promise<DbReturn>;
601
+ /**
602
+ * 获取文档
603
+ */
604
+ get(id: string): Promise<DbDoc | null>;
605
+ /**
606
+ * 删除文档
607
+ */
608
+ remove(doc: string | DbDoc): Promise<DbReturn>;
609
+ /**
610
+ * 批量操作文档(新增、修改、删除)
611
+ */
612
+ bulkDocs(docs: DbDoc[]): Promise<DbReturn[]>;
613
+ /**
614
+ * 获取所有文档 可根据文档id前缀查找
615
+ */
616
+ allDocs(key?: string): Promise<DbDoc[]>;
617
+ /**
618
+ * 存储附件到新文档
619
+ * @param docId 文档ID
620
+ * @param attachment 附件 buffer
621
+ * @param type 附件类型,示例:image/png, text/plain
622
+ */
623
+ postAttachment(docId: string, attachment: Uint8Array, type: string): Promise<DbReturn>;
624
+ /**
625
+ * 获取附件
626
+ * @param docId 文档ID
627
+ */
628
+ getAttachment(docId: string): Promise<Uint8Array | null>;
629
+ /**
630
+ * 获取附件类型
631
+ * @param docId 文档ID
632
+ */
633
+ getAttachmentType(docId: string): Promise<string | null>;
634
+ /**
635
+ * 云端复制数据状态 (null: 未开启数据同步、0: 已完成复制、1:复制中)
636
+ */
637
+ replicateStateFromCloud(): Promise<null | 0 | 1>;
638
+ }
602
639
  };
603
640
 
604
641
  dbStorage: {