electron/spec-main/fixtures/sub-frames/webview-iframe-preload.js
2020-03-20 13:28:31 -07:00

14 lines
434 B
JavaScript

const { ipcRenderer } = require('electron');
if (process.isMainFrame) {
window.addEventListener('DOMContentLoaded', () => {
const webview = document.createElement('webview');
webview.src = 'about:blank';
webview.addEventListener('did-finish-load', () => {
ipcRenderer.send('webview-loaded');
}, { once: true });
document.body.appendChild(webview);
});
} else {
ipcRenderer.send('preload-in-frame');
}