electron/spec/fixtures/sub-frames/preload.js

14 lines
369 B
JavaScript
Raw Normal View History

2020-03-20 20:28:31 +00:00
const { ipcRenderer, webFrame } = require('electron');
2020-03-20 20:28:31 +00:00
window.isolatedGlobal = true;
2020-03-20 20:28:31 +00:00
ipcRenderer.send('preload-ran', window.location.href, webFrame.routingId);
ipcRenderer.on('preload-ping', () => {
2020-03-20 20:28:31 +00:00
ipcRenderer.send('preload-pong', webFrame.routingId);
});
window.addEventListener('unload', () => {
ipcRenderer.send('preload-unload', window.location.href);
});