electron/lib/isolated_renderer/init.js
Samuel Attard 54ef906832
[RFC] perf: use an internal module resolver to improve require performance (#14633)
* perf: use an internal module resolver instead of relative requires

* perf: memoize the results of getting exported Electron properties

* perf: make internal module changes consistent across sandboxed / bundled files
2018-09-20 13:43:26 +10:00

25 lines
625 B
JavaScript

/* global binding */
'use strict'
const { send, sendSync } = binding
const ipcRenderer = {
send (...args) {
return send('ipc-message', args)
},
sendSync (...args) {
return sendSync('ipc-message-sync', args)[0]
},
// No-ops since events aren't received
on () {},
once () {}
}
let { guestInstanceId, hiddenPage, openerId, nativeWindowOpen } = binding
if (guestInstanceId != null) guestInstanceId = parseInt(guestInstanceId)
if (openerId != null) openerId = parseInt(openerId)
require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, hiddenPage, nativeWindowOpen)