Use destroyed event instead of closed event
This commit is contained in:
parent
4f46f75d8f
commit
4c1ede32cf
1 changed files with 3 additions and 3 deletions
|
@ -81,13 +81,13 @@ const removeBackgroundPages = function (manifest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch tabs events.
|
// Dispatch tabs events.
|
||||||
const hookWindowForTabEvents = function (win, webContents) {
|
const hookWindowForTabEvents = function (webContents) {
|
||||||
const tabId = webContents.id
|
const tabId = webContents.id
|
||||||
for (const page of objectValues(backgroundPages)) {
|
for (const page of objectValues(backgroundPages)) {
|
||||||
page.webContents.sendToAll('CHROME_TABS_ONCREATED', tabId)
|
page.webContents.sendToAll('CHROME_TABS_ONCREATED', tabId)
|
||||||
}
|
}
|
||||||
|
|
||||||
win.once('closed', () => {
|
webContents.once('destroyed', () => {
|
||||||
for (const page of objectValues(backgroundPages)) {
|
for (const page of objectValues(backgroundPages)) {
|
||||||
page.webContents.sendToAll('CHROME_TABS_ONREMOVED', tabId)
|
page.webContents.sendToAll('CHROME_TABS_ONREMOVED', tabId)
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ app.once('ready', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserWindow.prototype._loadDevToolsExtensions = function (webContents) {
|
BrowserWindow.prototype._loadDevToolsExtensions = function (webContents) {
|
||||||
hookWindowForTabEvents(this, webContents)
|
hookWindowForTabEvents(webContents)
|
||||||
webContents.on('devtools-opened', function () {
|
webContents.on('devtools-opened', function () {
|
||||||
loadDevToolsExtensions(webContents, objectValues(manifestMap))
|
loadDevToolsExtensions(webContents, objectValues(manifestMap))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue