electron/lib/renderer/extensions/web-navigation.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

21 lines
547 B
JavaScript

const Event = require('@electron/internal/renderer/extensions/event')
const { ipcRenderer } = require('electron')
class WebNavigation {
constructor () {
this.onBeforeNavigate = new Event()
this.onCompleted = new Event()
ipcRenderer.on('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', (event, details) => {
this.onBeforeNavigate.emit(details)
})
ipcRenderer.on('CHROME_WEBNAVIGATION_ONCOMPLETED', (event, details) => {
this.onCompleted.emit(details)
})
}
}
exports.setup = () => {
return new WebNavigation()
}