From cc9d182490576f58d0a23db6c3f72bea57f2803e Mon Sep 17 00:00:00 2001 From: renlu Date: Thu, 25 Nov 2021 18:20:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B8=B2=E6=9F=93=E8=BF=9B?= =?UTF-8?q?=E7=A8=8Bipcrender.on=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/preload/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/preload/index.ts b/src/preload/index.ts index 4a2231e..b552b0f 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -13,5 +13,10 @@ domReady().then(() => { // --------- Expose some API to Renderer process. --------- contextBridge.exposeInMainWorld('fs', fs) -contextBridge.exposeInMainWorld('ipcRenderer', ipcRenderer) contextBridge.exposeInMainWorld('removeLoading', removeLoading) +contextBridge.exposeInMainWorld('ipcRenderer', { + ...ipcRenderer, + on: (name: string, callback: () => {}) => { + ipcRenderer.on(name, callback) + } +})