mirror of https://github.com/electron/electron
10 lines
487 B
JavaScript
10 lines
487 B
JavaScript
const { contextBridge, ipcRenderer } = require('electron/renderer')
|
|
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
showDemoWindow: () => ipcRenderer.send('show-demo-window'),
|
|
focusDemoWindow: () => ipcRenderer.send('focus-demo-window'),
|
|
onWindowFocus: (callback) => ipcRenderer.on('window-focus', () => callback()),
|
|
onWindowBlur: (callback) => ipcRenderer.on('window-blur', () => callback()),
|
|
onWindowClose: (callback) => ipcRenderer.on('window-close', () => callback())
|
|
})
|