electron/atom/renderer/api/lib/ipc.coffee

20 lines
619 B
CoffeeScript
Raw Normal View History

{ipcRenderer, deprecate} = require 'electron'
2015-11-10 07:12:07 +00:00
{EventEmitter} = require 'events'
2015-11-09 13:18:57 +00:00
2015-11-10 07:12:07 +00:00
# This module is deprecated, we mirror everything from ipcRenderer.
deprecate.warn 'ipc module', 'require("electron").ipcRenderer'
2015-11-10 07:12:07 +00:00
# Routes events of ipcRenderer.
ipc = new EventEmitter
ipcRenderer.emit = (channel, event, args...) ->
ipc.emit channel, args...
EventEmitter::emit.apply ipcRenderer, arguments
2014-12-17 19:09:11 +00:00
# Deprecated.
2015-11-10 07:12:07 +00:00
for method of ipcRenderer when method.startsWith 'send'
ipc[method] = ipcRenderer[method]
2015-11-09 13:18:57 +00:00
deprecate.rename ipc, 'sendChannel', 'send'
deprecate.rename ipc, 'sendChannelSync', 'sendSync'
module.exports = ipc