@lvce-editor/ipc 13.1.0 → 13.3.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/dist/index.d.ts +58 -28
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,66 @@
|
|
|
1
|
-
interface Ipc extends EventTarget {
|
|
1
|
+
interface Ipc<T = any> extends EventTarget {
|
|
2
2
|
readonly send: (message: any) => void
|
|
3
3
|
readonly sendAndTransfer: (message: any, transfer: any) => void
|
|
4
|
-
readonly dispose: () => void
|
|
5
|
-
readonly isDisposed: () =>
|
|
4
|
+
readonly dispose: () => void | Promise<void>
|
|
5
|
+
readonly isDisposed: () => boolean
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
interface IpcChild {
|
|
9
|
-
readonly listen:
|
|
10
|
-
readonly wrap: (rawIpc:
|
|
8
|
+
interface IpcChild<WrapOptions = any, ListenOptions = any> {
|
|
9
|
+
readonly listen: (listenOptions: ListenOptions) => Promise<WrapOptions> | WrapOptions
|
|
10
|
+
readonly wrap: (rawIpc: WrapOptions) => Ipc<WrapOptions>
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const IpcChildWithWebSocket: IpcChild
|
|
17
|
-
export const IpcChildWithNodeWorker: IpcChild
|
|
18
|
-
export const IpcChildWithRendererProcess2: IpcChild
|
|
19
|
-
export const IpcChildWithModuleWorkerAndMessagePort: IpcChild
|
|
20
|
-
export const IpcChildWithModuleWorker: IpcChild
|
|
21
|
-
export const IpcChildWithMessagePort: IpcChild
|
|
22
|
-
export const IpcChildWithElectronWindow: IpcChild
|
|
23
|
-
|
|
24
|
-
interface IpcParent {
|
|
25
|
-
readonly create: any
|
|
26
|
-
readonly wrap: (rawIpc: any) => Ipc
|
|
13
|
+
interface IpcParent<WrapOptions = any, CreateOptions = any> {
|
|
14
|
+
readonly create: (options: CreateOptions) => Promise<WrapOptions>
|
|
15
|
+
readonly wrap: (rawIpc: WrapOptions) => Ipc<WrapOptions>
|
|
27
16
|
}
|
|
28
17
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export const
|
|
35
|
-
export const
|
|
36
|
-
|
|
18
|
+
interface IpcChildWithMessagePortListenOptions {
|
|
19
|
+
readonly port: MessagePort
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// MessagePort specific implementations
|
|
23
|
+
export const IpcChildWithMessagePort: IpcChild<MessagePort, IpcChildWithMessagePortListenOptions>
|
|
24
|
+
export const IpcParentWithMessagePort: IpcParent<MessagePort>
|
|
25
|
+
|
|
26
|
+
interface IpcChildWithElectronMessagePortListenOptions {
|
|
27
|
+
readonly messagePort: import('electron').MessagePortMain
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface IpcChildWithElectronUtilityProcessListenOptions {}
|
|
31
|
+
|
|
32
|
+
interface IpcChildWithElectronWindowListenOptions {}
|
|
33
|
+
|
|
34
|
+
// Electron specific implementations
|
|
35
|
+
export const IpcChildWithElectronMessagePort: IpcChild<import('electron').MessagePortMain, IpcChildWithElectronMessagePortListenOptions>
|
|
36
|
+
export const IpcChildWithElectronUtilityProcess: IpcChild<import('electron').MessagePortMain, IpcChildWithElectronUtilityProcessListenOptions>
|
|
37
|
+
export const IpcChildWithElectronWindow: IpcChild<Window, IpcChildWithElectronWindowListenOptions>
|
|
38
|
+
|
|
39
|
+
// Node specific implementations
|
|
40
|
+
export const IpcChildWithNodeWorker: IpcChild<import('worker_threads').MessagePort>
|
|
41
|
+
export const IpcChildWithNodeForkedProcess: IpcChild<import('child_process').ChildProcess>
|
|
42
|
+
export const IpcChildWithWebSocket: IpcChild<WebSocket>
|
|
43
|
+
|
|
44
|
+
// Web specific implementations
|
|
45
|
+
export const IpcChildWithModuleWorker: IpcChild<Worker>
|
|
46
|
+
export const IpcChildWithModuleWorkerAndMessagePort: IpcChild<MessagePort>
|
|
47
|
+
export const IpcChildWithRendererProcess2: IpcChild<MessagePort>
|
|
48
|
+
|
|
49
|
+
// Parent implementations
|
|
50
|
+
export const IpcParentWithElectronUtilityProcess: IpcParent<import('electron').MessagePortMain>
|
|
51
|
+
export const IpcParentWithNodeForkedProcess: IpcParent<import('child_process').ChildProcess>
|
|
52
|
+
export const IpcParentWithNodeWorker: IpcParent<import('worker_threads').Worker>
|
|
53
|
+
export const IpcParentWithElectronMessagePort: IpcParent<Electron.MessagePortMain>
|
|
54
|
+
export const IpcParentWithWebSocket: IpcParent<WebSocket>
|
|
55
|
+
export const IpcParentWithModuleWorker: IpcParent<Worker>
|
|
56
|
+
|
|
57
|
+
interface IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBugCreateOptions {
|
|
58
|
+
readonly sendPort: ({ port, url, name }: { port: MessagePort; url: string; name: string }) => Promise<void>
|
|
59
|
+
readonly url: string
|
|
60
|
+
readonly name: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug: IpcParent<
|
|
64
|
+
Worker,
|
|
65
|
+
IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBugCreateOptions
|
|
66
|
+
>
|