Add ipc.sendSync in renderer.
This commit is contained in:
parent
8f0b2b6363
commit
1b87a31940
10 changed files with 132 additions and 4 deletions
|
@ -1,15 +1,23 @@
|
|||
EventEmitter = require('events').EventEmitter
|
||||
send = process.atom_binding('ipc').send
|
||||
ipc = process.atom_binding('ipc')
|
||||
|
||||
class Ipc extends EventEmitter
|
||||
constructor: ->
|
||||
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
||||
@emit(args...)
|
||||
process.on 'ATOM_INTERNAL_MESSAGE_SYNC', (args...) =>
|
||||
@emit(args...)
|
||||
|
||||
send: (args...) ->
|
||||
@sendChannel('message', args...)
|
||||
|
||||
sendChannel: (args...) ->
|
||||
send('ATOM_INTERNAL_MESSAGE', args...)
|
||||
ipc.send('ATOM_INTERNAL_MESSAGE', args...)
|
||||
|
||||
sendSync: (args...) ->
|
||||
ipc.sendSync('ATOM_INTERNAL_MESSAGE_SYNC', 'sync-message', args...).result
|
||||
|
||||
sendChannelSync: (args...) ->
|
||||
ipc.sendSync('ATOM_INTERNAL_MESSAGE_SYNC', args...).result
|
||||
|
||||
module.exports = new Ipc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue