2016-09-26 20:40:45 +00:00
|
|
|
(function () {
|
2018-09-13 16:10:51 +00:00
|
|
|
const { setImmediate } = require('timers')
|
|
|
|
const { ipcRenderer } = require('electron')
|
2016-09-26 20:40:45 +00:00
|
|
|
window.ipcRenderer = ipcRenderer
|
2017-03-21 13:48:36 +00:00
|
|
|
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
|
2018-03-14 03:01:40 +00:00
|
|
|
if (process.env.sandboxmain) {
|
2018-07-30 01:13:42 +00:00
|
|
|
window.test = {
|
|
|
|
env: process.env,
|
|
|
|
execPath: process.execPath,
|
2018-08-21 18:05:45 +00:00
|
|
|
pid: process.pid,
|
|
|
|
arch: process.arch,
|
|
|
|
platform: process.platform,
|
|
|
|
resourcesPath: process.resourcesPath,
|
|
|
|
sandboxed: process.sandboxed,
|
|
|
|
type: process.type,
|
|
|
|
version: process.version,
|
|
|
|
versions: process.versions
|
2018-07-30 01:13:42 +00:00
|
|
|
}
|
2018-03-14 03:01:40 +00:00
|
|
|
}
|
2016-09-26 20:40:45 +00:00
|
|
|
} else if (location.href !== 'about:blank') {
|
|
|
|
addEventListener('DOMContentLoaded', () => {
|
|
|
|
ipcRenderer.send('child-loaded', window.opener == null, document.body.innerHTML)
|
|
|
|
}, false)
|
|
|
|
}
|
|
|
|
})()
|