2018-09-13 16:10:51 +00:00
|
|
|
const { ipcRenderer, webFrame } = require('electron')
|
2016-12-13 19:47:54 +00:00
|
|
|
|
|
|
|
window.foo = 3
|
|
|
|
|
2017-08-08 23:19:18 +00:00
|
|
|
webFrame.executeJavaScript('window.preloadExecuteJavaScriptProperty = 1234;')
|
|
|
|
|
2016-12-13 19:47:54 +00:00
|
|
|
window.addEventListener('message', (event) => {
|
|
|
|
ipcRenderer.send('isolated-world', {
|
|
|
|
preloadContext: {
|
|
|
|
preloadProperty: typeof window.foo,
|
|
|
|
pageProperty: typeof window.hello,
|
|
|
|
typeofRequire: typeof require,
|
2016-12-15 23:23:45 +00:00
|
|
|
typeofProcess: typeof process,
|
|
|
|
typeofArrayPush: typeof Array.prototype.push,
|
2018-08-31 20:51:29 +00:00
|
|
|
typeofFunctionApply: typeof Function.prototype.apply,
|
|
|
|
typeofPreloadExecuteJavaScriptProperty: typeof window.preloadExecuteJavaScriptProperty
|
2017-07-28 00:08:24 +00:00
|
|
|
},
|
|
|
|
pageContext: event.data
|
|
|
|
})
|
2016-12-13 19:47:54 +00:00
|
|
|
})
|