@solazah/solazah-runtime 0.1.24 → 0.1.26

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": "@solazah/solazah-runtime",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "main": "index.cjs",
5
5
  "module": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -1,6 +1,7 @@
1
1
  import { default as IpcRenderer } from './IpcRenderer';
2
2
  export default class SystemClipboard {
3
3
  private transport;
4
+ private seq;
4
5
  constructor(transport?: IpcRenderer);
5
6
  /**
6
7
  * 读取系统剪贴板当前内容,按 text → image → fileName → fileUrl 顺序依次探测,返回第一个命中的结果或 null。
@@ -21,4 +22,18 @@ export default class SystemClipboard {
21
22
  * @returns 无返回
22
23
  */
23
24
  clear: () => Promise<any>;
25
+ /**
26
+ * 订阅系统剪贴板变化,不用自己轮询。回调在每次剪贴板内容变化时收到新内容
27
+ * (与 `read()` 同形状:`{type, content}`);订阅当下不回调,只推此后的变化。
28
+ *
29
+ * 采样器在宿主侧,全应用共用一个,没有订阅者时完全不跑。
30
+ * 注意:连续复制两张**图片**识别不出来(格式与文本都没变化),文本以及图文之间的切换都能捕获。
31
+ *
32
+ * @param onChange 剪贴板变化回调,入参为新内容。
33
+ * @returns 退订闭包。**清理必须调用它**,不要试图自己 off 频道。
34
+ */
35
+ watch: (onChange: (data: {
36
+ type: string;
37
+ content: any;
38
+ }) => void) => (() => void);
24
39
  }