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