refactor ipc Main
This commit is contained in:
parent
a6351af83c
commit
a22b3c68e5
13 changed files with 139 additions and 114 deletions
20
src/types.ts
20
src/types.ts
|
|
@ -39,14 +39,34 @@ interface AccountCredentials {
|
|||
password: string;
|
||||
}
|
||||
|
||||
/*
|
||||
* Electron Ipc Main
|
||||
*/
|
||||
interface IpcHandlerCallback<I, O> {
|
||||
(payload: I | null): Promise<Error | O>;
|
||||
}
|
||||
|
||||
interface IpcListenerCallback<I> {
|
||||
(payload: I | null): void;
|
||||
}
|
||||
|
||||
interface IIpcHandler<I, O> {
|
||||
handle(): void;
|
||||
remove(): void;
|
||||
readonly _handlerCallback: IpcHandlerCallback<I, O>;
|
||||
}
|
||||
|
||||
interface IIpcListener<I> {
|
||||
listen(): void;
|
||||
remove(): void;
|
||||
readonly _listenerCallback: IpcListenerCallback<I>;
|
||||
}
|
||||
|
||||
interface IPCHandlers {
|
||||
[handler: string]: IIpcHandler<any, any>;
|
||||
}
|
||||
|
||||
interface IPCListeners {
|
||||
[listener: string]: IIpcListener<any>;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue