54ef906832
* 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
21 lines
547 B
JavaScript
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()
|
|
}
|