2018-09-22 12:28:50 +00:00
|
|
|
'use strict'
|
|
|
|
|
2018-09-20 03:43:26 +00:00
|
|
|
const Event = require('@electron/internal/renderer/extensions/event')
|
2019-02-15 01:24:25 +00:00
|
|
|
const { ipcRendererInternal } = require('@electron/internal/renderer/ipc-renderer-internal')
|
2016-06-16 16:46:26 +00:00
|
|
|
|
2016-06-16 19:07:59 +00:00
|
|
|
class WebNavigation {
|
|
|
|
constructor () {
|
|
|
|
this.onBeforeNavigate = new Event()
|
|
|
|
this.onCompleted = new Event()
|
2016-06-16 16:46:26 +00:00
|
|
|
|
2019-02-15 01:24:25 +00:00
|
|
|
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', (event, details) => {
|
2016-06-16 19:07:59 +00:00
|
|
|
this.onBeforeNavigate.emit(details)
|
|
|
|
})
|
|
|
|
|
2019-02-15 01:24:25 +00:00
|
|
|
ipcRendererInternal.on('CHROME_WEBNAVIGATION_ONCOMPLETED', (event, details) => {
|
2016-06-16 19:07:59 +00:00
|
|
|
this.onCompleted.emit(details)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.setup = () => {
|
|
|
|
return new WebNavigation()
|
|
|
|
}
|