Use require('ipc').send to communicate between browser and renderer.
This commit is contained in:
parent
c22d927b6f
commit
16244e42e0
19 changed files with 329 additions and 67 deletions
12
renderer/api/lib/ipc.coffee
Normal file
12
renderer/api/lib/ipc.coffee
Normal file
|
@ -0,0 +1,12 @@
|
|||
EventEmitter = require('events').EventEmitter
|
||||
send = process.atom_binding('ipc').send
|
||||
|
||||
class Ipc extends EventEmitter
|
||||
constructor: ->
|
||||
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
||||
@emit('message', args...)
|
||||
|
||||
send: (args...) ->
|
||||
send('ATOM_INTERNAL_MESSAGE', args...)
|
||||
|
||||
module.exports = new Ipc
|
Loading…
Add table
Add a link
Reference in a new issue