From e323625ccac65bfb4f166a9563ff25749d605905 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 20 Apr 2017 00:21:23 +0900 Subject: [PATCH] fix IPC event handling on macOS --- renderer/ipc.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/renderer/ipc.ts b/renderer/ipc.ts index a36fbc8..82bd699 100644 --- a/renderer/ipc.ts +++ b/renderer/ipc.ts @@ -4,8 +4,13 @@ const electron = r('electron'); const ipc = electron.ipcRenderer; export function on(channel: IpcChannelFromMain, callback: (...args: any[]) => void) { - ipc.on(channel, (_, ...args: any[]) => { + ipc.on(channel, (...args: any[]) => { log.info('IPC: Received from:', channel, args); + // XXX: Weird... + // First element is Event in Windows as documented. But not in macOS. + if (args[0] instanceof Event) { + args = args.splice(1); + } callback(...args); }); }