refactor: add emitCustomEvent() helper (#17960)
This commit is contained in:
parent
aebad6fd21
commit
6f5c850d60
5 changed files with 35 additions and 48 deletions
|
@ -350,22 +350,6 @@ WebContents.prototype._init = function () {
|
|||
})
|
||||
})
|
||||
|
||||
const forwardedEvents = [
|
||||
'desktop-capturer-get-sources',
|
||||
'remote-require',
|
||||
'remote-get-global',
|
||||
'remote-get-builtin',
|
||||
'remote-get-current-window',
|
||||
'remote-get-current-web-contents',
|
||||
'remote-get-guest-web-contents'
|
||||
]
|
||||
|
||||
for (const eventName of forwardedEvents) {
|
||||
this.on(eventName, (event, ...args) => {
|
||||
app.emit(eventName, event, this, ...args)
|
||||
})
|
||||
}
|
||||
|
||||
this.on('crashed', (event, ...args) => {
|
||||
app.emit('renderer-process-crashed', event, this, ...args)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue