Forward will/did navigate events to extensions
This commit is contained in:
parent
567622c126
commit
65abaee299
3 changed files with 52 additions and 11 deletions
|
@ -1,5 +1,21 @@
|
|||
const Event = require('./event')
|
||||
const {ipcRenderer} = require('electron')
|
||||
|
||||
exports.onBeforeNavigate = new Event()
|
||||
class WebNavigation {
|
||||
constructor () {
|
||||
this.onBeforeNavigate = new Event()
|
||||
this.onCompleted = new Event()
|
||||
|
||||
exports.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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue