electron/spec/fixtures/module/preload-sandbox.js

16 lines
504 B
JavaScript
Raw Normal View History

2016-09-26 20:40:45 +00:00
(function () {
const {setImmediate} = require('timers')
2016-09-26 20:40:45 +00:00
const {ipcRenderer} = require('electron')
window.ipcRenderer = ipcRenderer
window.setImmediate = setImmediate
2017-05-15 12:17:07 +00:00
window.require = require
2016-09-26 20:40:45 +00:00
if (location.protocol === 'file:') {
window.test = 'preload'
window.process = process
} else if (location.href !== 'about:blank') {
addEventListener('DOMContentLoaded', () => {
ipcRenderer.send('child-loaded', window.opener == null, document.body.innerHTML)
}, false)
}
})()