-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.d.ts
43 lines (36 loc) · 977 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import "electron";
declare namespace EipHop {
export interface RequestObject<Payload> {
payload: Payload;
}
export interface ResponseObject<Response, Error> {
send: (response?: Response) => void;
notify: (response?: Response) => void;
error: (error?: Error) => void;
}
export interface Action<Payload = any, Response = any, Error = any> {
(
request: RequestObject<Payload>,
response: ResponseObject<Response, Error>
): void;
}
export interface Actions {
[x: string]: Action;
}
}
export const setupMainHandler: (
electronModule: { ipcMain: typeof Electron.ipcMain },
actions: EipHop.Actions,
enableLogs?: boolean
) => void;
export const setupFrontendListener: (electronModule: {
ipcRenderer: {
send: typeof Electron.ipcRenderer.send,
on: typeof Electron.ipcRenderer.on
}
}) => void;
export const emit: <Response = any>(
action: string,
payload?: any,
notify?: any,
) => Promise<Response>;