refactor: make IpcEvent an interface (from type)
This commit is contained in:
parent
9d39632b73
commit
254e4216e6
|
@ -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;
|
||||||
};
|
}
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
Loading…
Reference in New Issue