Add sendToHost method

This commit is contained in:
Cheng Zhao 2014-12-17 11:09:11 -08:00
parent d46300587a
commit a8f5a4e2d4
5 changed files with 17 additions and 7 deletions

View file

@ -66,8 +66,8 @@ createGuest = (embedder, params) ->
guest.on event, (_, args...) ->
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_DISPATCH_EVENT-#{guest.viewInstanceId}", event, args...
# Dispatch guest's asynchronous IPC messages to embedder.
guest.on 'ipc-message', (_, channel, args...) ->
# Dispatch guest's IPC messages to embedder.
guest.on 'ipc-message-host', (_, channel, args...) ->
embedder.send "ATOM_SHELL_GUEST_VIEW_INTERNAL_IPC_MESSAGE-#{guest.viewInstanceId}", channel, args...
# Autosize.

View file

@ -16,6 +16,9 @@ class Ipc extends EventEmitter
sendSync: (args...) ->
JSON.parse ipc.sendSync('ipc-message-sync', [args...])
sendToHost: (args...) ->
ipc.send 'ipc-message-host', [args...]
# Discarded
sendChannel: -> @send.apply this, arguments
sendChannelSync: -> @sendSync.apply this, arguments