From d02ced87b8481262f489ae4d87ff5366459ea263 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Thu, 27 Aug 2015 10:13:25 -0700 Subject: [PATCH] =?UTF-8?q?message=20=E2=86=92=20arg,=2080-col?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/ipc-main-process.md | 7 ++++--- docs/api/ipc-renderer.md | 29 ++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/docs/api/ipc-main-process.md b/docs/api/ipc-main-process.md index 197b98e418be..c34564ef82ef 100644 --- a/docs/api/ipc-main-process.md +++ b/docs/api/ipc-main-process.md @@ -64,9 +64,10 @@ Set this to the value to be returned in a synchronous message. Returns the `WebContents` that sent the message. -### `Event.sender.send(channel[, message])` +### `Event.sender.send(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. -* `message` (optional) +* `arg` (optional) -This sends an asynchronous message back to the render process. The `message` can be any value. +This sends an asynchronous message back to the render process. Optionally, there +can be one or a series of arguments, `arg`, which can have any type. diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index 0d7b49aba701..4a5995663884 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -1,7 +1,8 @@ # ipc (renderer) The `ipc` module provides a few methods so you can send synchronous and -asynchronous messages from the render process (web page) to the main process. You can also receive messages returned from the main process. +asynchronous messages from the render process (web page) to the main process. +You can also receive messages returned from the main process. **Note**: If you want to make use of modules in the main process from the renderer process, you might consider using the [remote](remote.md) module. @@ -12,30 +13,40 @@ See [ipc (main process)](ipc-main-process.md) for code examples. The `ipc` module has the following methods for sending messages: -**Note**: When using these methods to send a `message` you must also listen for it in the main process with [`ipc (main process)`](ipc-main-process.md). +**Note**: When using these methods to send a `message` you must also listen +for it in the main process with [`ipc (main process)`](ipc-main-process.md). -### `ipc.send(channel[, message])` +### `ipc.send(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. * `message` (optional) -Send a `message` (any type) to the main process asynchronously via a `channel`. The main process handles it by listening for the `channel` event with `ipc`. +Send an event to the main process asynchronously via a `channel`. Optionally, +there can be a message: one or a series of arguments, `arg`, which can have any +type. The main process handles it by listening for the `channel` event with +`ipc`. -### `ipc.sendSync(channel[, message])` +### `ipc.sendSync(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. * `message` (optional) -Send a `message` (any type) to the main process synchronously via a `channel`. A result is returned from the main process. +Send an event to the main process synchronously via a `channel`. Optionally, +there can be a message: one or a series of arguments, `arg`, which can have any +type. The main process handles it by listening for the `channel` event with +`ipc`. -The main process handles it by listening for the `channel` event with `ipc` and replies by setting the `event.returnValue`. +The main process handles it by listening for the `channel` event with `ipc` and +replies by setting the `event.returnValue`. **Note:** Sending a synchronous message will block the whole renderer process so using this method is not recommended. -### `ipc.sendToHost(channel[, message])` +### `ipc.sendToHost(channel[, arg1][, arg2][, ...])` * `channel` String - The event name. * `message` (optional) -Like `ipc.send` but the message will be sent to the host page in a `` instead of the main process. +Like `ipc.send` but the event will be sent to the host page in a `` +instead of the main process. Optionally, there can be a message: one or a series +of arguments, `arg`, which can have any type.