]> khamidou — GitHub mirrors - electron.git/commitdiff
First run t ipc-r
authorJessica Lord <jlord@github.com>
Thu, 27 Aug 2015 00:56:10 +0000 (17:56 -0700)
committerJessica Lord <jlord@github.com>
Thu, 27 Aug 2015 00:56:10 +0000 (17:56 -0700)
docs/api/ipc-renderer.md

index 3aee11d781c9c46eae7daf164c5340a27923bac1..0d7b49aba7013793a059495a01db92b17a66bf07 100644 (file)
@@ -1,29 +1,41 @@
 # ipc (renderer)
 
 The `ipc` module provides a few methods so you can send synchronous and
-asynchronous messages to the main process, and also receive messages sent from
-main process. If you want to make use of modules of main process from renderer
+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.
 
-See [ipc (main process)](ipc-main-process.md) for examples.
+See [ipc (main process)](ipc-main-process.md) for code examples.
+
+## Methods
+
+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).
+
+### `ipc.send(channel[, message])`
+
+* `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`.
 
-## ipc.send(channel[, args...])
+### `ipc.sendSync(channel[, message])`
 
-Send `args..` to the renderer via `channel` in asynchronous message, the main
-process can handle it by listening to the `channel` event of `ipc` module.
+* `channel` String - The event name.
+* `message` (optional)
 
-## ipc.sendSync(channel[, args...])
+Send a `message` (any type) to the main process synchronously via a `channel`. A result is returned from the main process.
 
-Send `args..` to the renderer via `channel` in synchronous message, and returns
-the result sent from main process. The main process can handle it by listening to
-the `channel` event of `ipc` module, and returns by setting `event.returnValue`.
+The main process handles it by listening for the `channel` event with `ipc` and replies by setting the `event.returnValue`.
 
-**Note:** Usually developers should never use this API, since sending
-synchronous message would block the whole renderer process.
+**Note:** Sending a synchronous message will block the whole renderer process so
+using this method is not recommended.
 
-## ipc.sendToHost(channel[, args...])
+### `ipc.sendToHost(channel[, message])`
 
-Like `ipc.send` but the message will be sent to the host page instead of the
-main process.
+* `channel` String - The event name.
+* `message` (optional)
 
-This is mainly used by the page in `<webview>` to communicate with host page.
+Like `ipc.send` but the message will be sent to the host page in a `<webview>` instead of the main process.