Text edits
This commit is contained in:
parent
2ead38b03f
commit
0fa0aedd86
2 changed files with 15 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
@ -42,10 +43,11 @@ includes `file:` and `filesystem:`.
|
|||
* `handler` Function
|
||||
* `completion` Function (optional)
|
||||
|
||||
Registers a protocol of `scheme` that will send the file as a response. The `handler`
|
||||
will be called with `handler(request, callback)` when a `request` is going to be
|
||||
created with `scheme` and `completion` will be called with `completion(null)`
|
||||
when `scheme` is successfully registered, or `completion(error)` when failed.
|
||||
Registers a protocol of `scheme` that will send the file as a response. The
|
||||
`handler` will be called with `handler(request, callback)` when a `request` is
|
||||
going to be created with `scheme`. `completion` will be called with
|
||||
`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
|
||||
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
|
||||
`error` property, the `request` will fail with the `error` number you
|
||||
specified. For the available error numbers you can use, please see:
|
||||
https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h
|
||||
specified. For the available error numbers you can use, please see the
|
||||
[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
|
||||
from protocols that follow "generic URI syntax" like `file:`, so you probably
|
||||
want to call `protocol.registerStandardSchemes` to have your scheme treated as a
|
||||
standard scheme.
|
||||
than protocols that follow the "generic URI syntax" like `file:`, so you
|
||||
probably want to call `protocol.registerStandardSchemes` to have your scheme
|
||||
treated as a standard scheme.
|
||||
|
||||
### `protocol.registerBufferProtocol(scheme, handler[, completion])`
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# remote
|
||||
|
||||
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.
|
||||
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
|
||||
main process object without explicitly sending inter-process messages, similar
|
||||
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
|
||||
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
|
||||
passed to the main process. This involves cleaning up event handlers, or
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue