2016-06-16 16:51:54 +00:00
|
|
|
const Event = require('./event')
|
2016-06-16 19:07:59 +00:00
|
|
|
const {ipcRenderer} = require('electron')
|
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
|
|
|
|
2016-06-16 19:07:59 +00:00
|
|
|
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()
|
|
|
|
}
|