refactor: make IpcEvent an interface (from type)
This commit is contained in:
parent
9d39632b73
commit
254e4216e6
|
@ -1,8 +1,8 @@
|
|||
import WebContents = Electron.WebContents;
|
||||
|
||||
declare type IpcEvent = {
|
||||
declare interface IIpcEvent {
|
||||
frameId: number;
|
||||
preventDefault: () => void;
|
||||
reply: (channel: string, ...args: any) => void;
|
||||
sender: WebContents;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import { isLoggedIn, login } from '../services/nhentai-crawler';
|
|||
|
||||
const ipcServer: IIpcServer = {
|
||||
answer: (channel: IpcChannels, handler: (data?: any) => Promise<any>): void => {
|
||||
ipcMain.on(channel, (event: IpcEvent, payload: IIpcPayload) => {
|
||||
ipcMain.on(channel, (event: IIpcEvent, payload: IIpcPayload) => {
|
||||
handler(payload.data)
|
||||
.then((result: any) => {
|
||||
const response: IIpcResponse = {
|
||||
|
|
Loading…
Reference in New Issue