electron/atom/renderer/api/lib/ipc-renderer.coffee
Cheng Zhao c6634b1ea5 Don't pump message loop when sending sync msg
In old days sending sync message to browser process requires pumping
message loop in the renderer process, but now in Chrome 47 it is not
true anymore. And even when we do it, the Send method may fail
sometimes, so this change seems to be required for the Chrome 47
upgrade.
2015-12-16 22:38:04 +08:00

18 lines
473 B
CoffeeScript

{EventEmitter} = require 'events'
binding = process.atomBinding 'ipc'
v8Util = process.atomBinding 'v8_util'
# Created by init.coffee.
ipcRenderer = v8Util.getHiddenValue global, 'ipc'
ipcRenderer.send = (args...) ->
binding.send 'ipc-message', [args...]
ipcRenderer.sendSync = (args...) ->
JSON.parse binding.sendSync('ipc-message-sync', [args...])
ipcRenderer.sendToHost = (args...) ->
binding.send 'ipc-message-host', [args...]
module.exports = ipcRenderer