b163187235
* docs: avoid leaking the `IpcRendererEvent` in `contextBridge` examples * Update docs/fiddles/ipc/pattern-3/preload.js Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * Update docs/tutorial/ipc.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * Update docs/tutorial/ipc.md Co-authored-by: David Sanders <dsanders11@ucsbalum.com> --------- Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
6 lines
292 B
JavaScript
6 lines
292 B
JavaScript
const { contextBridge, ipcRenderer } = require('electron/renderer')
|
|
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
onUpdateCounter: (callback) => ipcRenderer.on('update-counter', (_event, value) => callback(value)),
|
|
counterValue: (value) => ipcRenderer.send('counter-value', value)
|
|
})
|