electron/docs/fiddles/ipc/webview-new-window/preload.js

6 lines
286 B
JavaScript

const { ipcRenderer } = require('electron/renderer')
const webview = document.getElementById('webview')
ipcRenderer.on('webview-new-window', (e, webContentsId, details) => {
console.log('webview-new-window', webContentsId, details)
webview.dispatchEvent(new Event('new-window'))
})