Text edits

This commit is contained in:
Jessica Lord 2015-09-01 19:08:31 -07:00
parent 2ead38b03f
commit 0fa0aedd86
2 changed files with 15 additions and 13 deletions

View file

@ -22,7 +22,8 @@ app.on('ready', function() {
}); });
``` ```
**Note:** This module can only be used after the `ready` event was emitted. **Note:** This module can only be used after the `ready` event in the `app`
module is emitted.
## Methods ## Methods
@ -42,10 +43,11 @@ includes `file:` and `filesystem:`.
* `handler` Function * `handler` Function
* `completion` Function (optional) * `completion` Function (optional)
Registers a protocol of `scheme` that will send the file as a response. The `handler` Registers a protocol of `scheme` that will send the file as a response. The
will be called with `handler(request, callback)` when a `request` is going to be `handler` will be called with `handler(request, callback)` when a `request` is
created with `scheme` and `completion` will be called with `completion(null)` going to be created with `scheme`. `completion` will be called with
when `scheme` is successfully registered, or `completion(error)` when failed. `completion(null)` when `scheme` is successfully registered or
`completion(error)` when failed.
To handle the `request`, the `callback` should be called with either the file's To handle the `request`, the `callback` should be called with either the file's
path or an object that has a `path` property, e.g. `callback(filePath)` or path or an object that has a `path` property, e.g. `callback(filePath)` or
@ -53,13 +55,13 @@ path or an object that has a `path` property, e.g. `callback(filePath)` or
When `callback` is called with nothing, a number, or an object that has an When `callback` is called with nothing, a number, or an object that has an
`error` property, the `request` will fail with the `error` number you `error` property, the `request` will fail with the `error` number you
specified. For the available error numbers you can use, please see: specified. For the available error numbers you can use, please see the
https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h [net error list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h).
By default the `scheme` is treated like `http:`, which is parsed differently By default the `scheme` is treated like `http:`, which is parsed differently
from protocols that follow "generic URI syntax" like `file:`, so you probably than protocols that follow the "generic URI syntax" like `file:`, so you
want to call `protocol.registerStandardSchemes` to have your scheme treated as a probably want to call `protocol.registerStandardSchemes` to have your scheme
standard scheme. treated as a standard scheme.
### `protocol.registerBufferProtocol(scheme, handler[, completion])` ### `protocol.registerBufferProtocol(scheme, handler[, completion])`

View file

@ -1,11 +1,11 @@
# remote # remote
The `remote` module provides a simple way to do inter-process communication The `remote` module provides a simple way to do inter-process communication
between the renderer process (web page) and the main process. (IPC) between the renderer process (web page) and the main process.
In Electron, only GUI-unrelated modules are available in the renderer process. In Electron, only GUI-unrelated modules are available in the renderer process.
Without the `remote` module, users who want to call a main process API in Without the `remote` module, users who want to call a main process API in
the renderer process would have to explicitly send inter-process messages the renderer process will have to explicitly send inter-process messages
to the main process. With the `remote` module, you can invoke methods of the to the main process. With the `remote` module, you can invoke methods of the
main process object without explicitly sending inter-process messages, similar main process object without explicitly sending inter-process messages, similar
to Java's [RMI](http://en.wikipedia.org/wiki/Java_remote_method_invocation). to Java's [RMI](http://en.wikipedia.org/wiki/Java_remote_method_invocation).
@ -114,7 +114,7 @@ callback will be installed again, leaking one callback for each restart.
To make things worse, since the context of previously installed callbacks has To make things worse, since the context of previously installed callbacks has
been released, exceptions will be raised in the main process when the `close` been released, exceptions will be raised in the main process when the `close`
event is emitted . event is emitted.
To avoid this problem, ensure you clean up any references to renderer callbacks To avoid this problem, ensure you clean up any references to renderer callbacks
passed to the main process. This involves cleaning up event handlers, or passed to the main process. This involves cleaning up event handlers, or