Avoid using processId and routingId directly.

This commit is contained in:
Cheng Zhao 2014-04-25 16:45:14 +08:00
parent 23ccad4915
commit 1bba15cb7f
4 changed files with 26 additions and 39 deletions

View file

@ -7,10 +7,14 @@ module.exports.wrap = (webContents) ->
# webContents is an EventEmitter.
webContents.__proto__ = EventEmitter.prototype
# Add the send method.
# WebContents::send(channel, args..)
webContents.send = (args...) ->
@_send 'ATOM_INTERNAL_MESSAGE', [args...]
# The processId and routingId and identify a webContents.
webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}"
webContents.equal = (other) -> @getId() is other.getId()
# Dispatch IPC messages to the ipc module.
webContents.on 'ipc-message', (event, channel, args...) =>
Object.defineProperty event, 'sender', value: webContents