refactor: make IpcEvent an interface (from type)

This commit is contained in:
Xymorot 2019-08-01 23:40:57 +02:00
parent 9d39632b73
commit 254e4216e6
2 changed files with 3 additions and 3 deletions

View File

@ -1,8 +1,8 @@
import WebContents = Electron.WebContents; import WebContents = Electron.WebContents;
declare type IpcEvent = { declare interface IIpcEvent {
frameId: number; frameId: number;
preventDefault: () => void; preventDefault: () => void;
reply: (channel: string, ...args: any) => void; reply: (channel: string, ...args: any) => void;
sender: WebContents; sender: WebContents;
}; }

View File

@ -3,7 +3,7 @@ import { isLoggedIn, login } from '../services/nhentai-crawler';
const ipcServer: IIpcServer = { const ipcServer: IIpcServer = {
answer: (channel: IpcChannels, handler: (data?: any) => Promise<any>): void => { 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) handler(payload.data)
.then((result: any) => { .then((result: any) => {
const response: IIpcResponse = { const response: IIpcResponse = {