mirror of
https://github.com/electron/electron.git
synced 2026-01-22 13:58:01 -05:00
Send message to window directly when passing BrowserWindow for ipc.send.
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
EventEmitter = require('events').EventEmitter
|
||||
send = process.atomBinding('ipc').send
|
||||
|
||||
sendWrap = (channel, processId, routingId, args...) ->
|
||||
BrowserWindow = require 'browser_window'
|
||||
if processId?.constructor is BrowserWindow
|
||||
window = processId
|
||||
processId = window.getProcessId()
|
||||
routingId = window.getRoutingId()
|
||||
|
||||
send channel, processId, routingId, args...
|
||||
|
||||
class Ipc extends EventEmitter
|
||||
constructor: ->
|
||||
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
||||
@@ -12,6 +21,6 @@ class Ipc extends EventEmitter
|
||||
@sendChannel(processId, routingId, 'message', args...)
|
||||
|
||||
sendChannel: (args...) ->
|
||||
send('ATOM_INTERNAL_MESSAGE', args...)
|
||||
sendWrap('ATOM_INTERNAL_MESSAGE', args...)
|
||||
|
||||
module.exports = new Ipc
|
||||
|
||||
Reference in New Issue
Block a user