electron/docs/fiddles/windows/manage-windows/manage-window-state/preload.js

7 lines
271 B
JavaScript

const { contextBridge, ipcRenderer } = require('electron/renderer')
contextBridge.exposeInMainWorld('electronAPI', {
createDemoWindow: () => ipcRenderer.send('create-demo-window'),
onBoundsChanged: (callback) => ipcRenderer.on('bounds-changed', () => callback())
})