Fail quietly when getting null renderer view.
It happens when the window is closing.
This commit is contained in:
parent
287c948845
commit
e5afa72b4d
2 changed files with 14 additions and 39 deletions
|
@ -4,23 +4,21 @@ ipc = process.atomBinding('ipc')
|
|||
class Ipc extends EventEmitter
|
||||
constructor: ->
|
||||
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
||||
@emit(args...)
|
||||
@emit args...
|
||||
|
||||
window.addEventListener 'unload', (event) ->
|
||||
process.removeAllListeners 'ATOM_INTERNAL_MESSAGE'
|
||||
|
||||
send: (args...) ->
|
||||
ipc.send('ATOM_INTERNAL_MESSAGE', 'message', args...)
|
||||
@sendChannel 'message', args...
|
||||
|
||||
sendChannel: (args...) ->
|
||||
ipc.send('ATOM_INTERNAL_MESSAGE', args...)
|
||||
ipc.send 'ATOM_INTERNAL_MESSAGE', [args...]
|
||||
|
||||
sendSync: (args...) ->
|
||||
msg = ipc.sendSync('ATOM_INTERNAL_MESSAGE_SYNC', 'sync-message', args...)
|
||||
JSON.parse(msg)
|
||||
@sendSync 'sync-message', args...
|
||||
|
||||
sendChannelSync: (args...) ->
|
||||
msg = ipc.sendSync('ATOM_INTERNAL_MESSAGE_SYNC', args...)
|
||||
JSON.parse(msg)
|
||||
JSON.parse ipc.sendSync('ATOM_INTERNAL_MESSAGE_SYNC', [args...])
|
||||
|
||||
module.exports = new Ipc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue