electron/lib/renderer/extensions/web-navigation.js

24 lines
626 B
JavaScript
Raw Normal View History

'use strict'
const Event = require('@electron/internal/renderer/extensions/event')
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal')
2016-06-16 16:46:26 +00:00
class WebNavigation {
constructor () {
this.onBeforeNavigate = new Event()
this.onCompleted = new Event()
2016-06-16 16:46:26 +00:00
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', (event, details) => {
this.onBeforeNavigate.emit(details)
})
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONCOMPLETED', (event, details) => {
this.onCompleted.emit(details)
})
}
}
exports.setup = () => {
return new WebNavigation()
}