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) + } +})