electron/docs/fiddles/ipc/pattern-3/preload.js

6 lines
186 B
JavaScript

const { contextBridge, ipcRenderer } = require('electron')
contextBridge.exposeInMainWorld('electronAPI', {
handleCounter: (callback) => ipcRenderer.on('update-counter', callback)
})