2013-04-23 04:18:07 +00:00
|
|
|
EventEmitter = require('events').EventEmitter
|
|
|
|
send = process.atom_binding('ipc').send
|
|
|
|
|
|
|
|
class Ipc extends EventEmitter
|
|
|
|
constructor: ->
|
|
|
|
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
2013-04-23 12:57:14 +00:00
|
|
|
@emit(args...)
|
2013-04-23 13:52:19 +00:00
|
|
|
process.on 'ATOM_INTERNAL_MESSAGE_SYNC', (args...) =>
|
|
|
|
@emit(args...)
|
2013-04-23 04:18:07 +00:00
|
|
|
|
|
|
|
send: (process_id, routing_id, args...) ->
|
2013-04-23 12:57:14 +00:00
|
|
|
@sendChannel(process_id, routing_id, 'message', args...)
|
2013-04-23 09:21:34 +00:00
|
|
|
|
|
|
|
sendChannel: (args...) ->
|
2013-04-23 12:57:14 +00:00
|
|
|
send('ATOM_INTERNAL_MESSAGE', args...)
|
2013-04-23 04:18:07 +00:00
|
|
|
|
|
|
|
module.exports = new Ipc
|