Co-locate with other private methods

This commit is contained in:
Kevin Sawicki 2016-11-30 16:59:59 -08:00
parent f3d391e3f2
commit ec43dd067c

View file

@ -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()