Co-locate with other private methods
This commit is contained in:
parent
f3d391e3f2
commit
ec43dd067c
1 changed files with 12 additions and 12 deletions
|
@ -36,18 +36,6 @@ class ObjectsRegistry {
|
|||
return id
|
||||
}
|
||||
|
||||
// Clear the storage when webContents is reloaded/navigated.
|
||||
registerDeleteListener (webContents, webContentsId) {
|
||||
const processId = webContents.getProcessId()
|
||||
const listener = (event, deletedProcessId) => {
|
||||
if (deletedProcessId === processId) {
|
||||
webContents.removeListener('render-view-deleted', listener)
|
||||
this.clear(webContentsId)
|
||||
}
|
||||
}
|
||||
webContents.on('render-view-deleted', listener)
|
||||
}
|
||||
|
||||
// Get an object according to its ID.
|
||||
get (id) {
|
||||
const pointer = this.storage[id]
|
||||
|
@ -102,6 +90,18 @@ class ObjectsRegistry {
|
|||
delete this.storage[id]
|
||||
}
|
||||
}
|
||||
|
||||
// Private: Clear the storage when webContents is reloaded/navigated.
|
||||
registerDeleteListener (webContents, webContentsId) {
|
||||
const processId = webContents.getProcessId()
|
||||
const listener = (event, deletedProcessId) => {
|
||||
if (deletedProcessId === processId) {
|
||||
webContents.removeListener('render-view-deleted', listener)
|
||||
this.clear(webContentsId)
|
||||
}
|
||||
}
|
||||
webContents.on('render-view-deleted', listener)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new ObjectsRegistry()
|
||||
|
|
Loading…
Reference in a new issue