docs: document that when invoke
rejects, it gives a different Error (#36127)
This commit is contained in:
parent
09302a2fc6
commit
a75e8e051e
1 changed files with 15 additions and 8 deletions
|
@ -96,14 +96,6 @@ Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will no
|
||||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||||
throw an exception.
|
throw an exception.
|
||||||
|
|
||||||
> **NOTE:** Sending non-standard JavaScript types such as DOM objects or
|
|
||||||
> special Electron objects will throw an exception.
|
|
||||||
>
|
|
||||||
> Since the main process does not have support for DOM objects such as
|
|
||||||
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
|
|
||||||
> Electron's IPC to the main process, as the main process would have no way to decode
|
|
||||||
> them. Attempting to send such objects over IPC will result in an error.
|
|
||||||
|
|
||||||
The main process should listen for `channel` with
|
The main process should listen for `channel` with
|
||||||
[`ipcMain.handle()`](./ipc-main.md#ipcmainhandlechannel-listener).
|
[`ipcMain.handle()`](./ipc-main.md#ipcmainhandlechannel-listener).
|
||||||
|
|
||||||
|
@ -126,6 +118,21 @@ If you need to transfer a [`MessagePort`][] to the main process, use [`ipcRender
|
||||||
|
|
||||||
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
If you do not need a response to the message, consider using [`ipcRenderer.send`](#ipcrenderersendchannel-args).
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
> Sending non-standard JavaScript types such as DOM objects or
|
||||||
|
> special Electron objects will throw an exception.
|
||||||
|
>
|
||||||
|
> Since the main process does not have support for DOM objects such as
|
||||||
|
> `ImageBitmap`, `File`, `DOMMatrix` and so on, such objects cannot be sent over
|
||||||
|
> Electron's IPC to the main process, as the main process would have no way to decode
|
||||||
|
> them. Attempting to send such objects over IPC will result in an error.
|
||||||
|
|
||||||
|
> **Note**
|
||||||
|
> If the handler in the main process throws an error,
|
||||||
|
> the promise returned by `invoke` will reject.
|
||||||
|
> However, the `Error` object in the renderer process
|
||||||
|
> will not be the same as the one thrown in the main process.
|
||||||
|
|
||||||
### `ipcRenderer.sendSync(channel, ...args)`
|
### `ipcRenderer.sendSync(channel, ...args)`
|
||||||
|
|
||||||
* `channel` string
|
* `channel` string
|
||||||
|
|
Loading…
Reference in a new issue