mirror of
https://github.com/HackPlan/atom-shell.git
synced 2026-04-24 03:46:03 +08:00
Prefer event.returnValue to event.result for sync messages.
This commit is contained in:
@@ -18,7 +18,7 @@ Emitted when renderer sent a message to the browser.
|
||||
* `routingId` Integer
|
||||
|
||||
Emitted when renderer sent a synchronous message to the browser. The receiver
|
||||
should store the result in `event.result`.
|
||||
should store the result in `event.returnValue`.
|
||||
|
||||
**Note:** Due to the limitation of `EventEmitter`, returning value in the
|
||||
event handler has no effect, so we have to store the result by using the
|
||||
|
||||
@@ -30,7 +30,7 @@ An example of sending synchronous message from renderer to browser:
|
||||
// In browser:
|
||||
var ipc = require('ipc');
|
||||
ipc.on('browser-data-request', function(event, processId, routingId, message) {
|
||||
event.result = 'THIS SOME DATA FROM THE BROWSER';
|
||||
event.returnValue = 'THIS SOME DATA FROM THE BROWSER';
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user