Clear listeners on process object when unloading.
The process object is created under node context, and it will live through the reloading, so we are responsible for clearing the listeners to make sure resources are not leaked.
This commit is contained in:
parent
6bf0d5d798
commit
84dc221b2e
1 changed files with 3 additions and 0 deletions
|
@ -6,6 +6,9 @@ class Ipc extends EventEmitter
|
||||||
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
||||||
@emit(args...)
|
@emit(args...)
|
||||||
|
|
||||||
|
window.addEventListener 'unload', (event) ->
|
||||||
|
process.removeAllListeners 'ATOM_INTERNAL_MESSAGE'
|
||||||
|
|
||||||
send: (args...) ->
|
send: (args...) ->
|
||||||
ipc.send('ATOM_INTERNAL_MESSAGE', 'message', args...)
|
ipc.send('ATOM_INTERNAL_MESSAGE', 'message', args...)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue