docs: remove reference to remote from faq (#24816)

This commit is contained in:
Jeremy Rose 2020-08-04 12:08:44 -07:00 committed by GitHub
parent 9c234f3f3f
commit 30cd9cdf2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,26 +43,14 @@ use HTML5 APIs which are already available in browsers. Good candidates are
[Storage API][storage], [`localStorage`][local-storage], [Storage API][storage], [`localStorage`][local-storage],
[`sessionStorage`][session-storage], and [IndexedDB][indexed-db]. [`sessionStorage`][session-storage], and [IndexedDB][indexed-db].
Or you can use the IPC system, which is specific to Electron, to store objects Alternatively, you can use the IPC primitives that are provided by Electron. To
in the main process as a global variable, and then to access them from the share data between the main and renderer processes, you can use the
renderers through the `remote` property of `electron` module: [`ipcMain`](api/ipc-main.md) and [`ipcRenderer`](api/ipc-renderer.md) modules.
To communicate directly between web pages, you can send a
```javascript [`MessagePort`][message-port] from one to the other, possibly via the main process
// In the main process. using [`ipcRenderer.postMessage()`](api/ipc-renderer.md#ipcrendererpostmessagechannel-message-transfer).
global.sharedObject = { Subsequent communication over message ports is direct and does not detour through
someProperty: 'default value' the main process.
}
```
```javascript
// In page 1.
require('electron').remote.getGlobal('sharedObject').someProperty = 'new value'
```
```javascript
// In page 2.
console.log(require('electron').remote.getGlobal('sharedObject').someProperty)
```
## My app's tray disappeared after a few minutes. ## My app's tray disappeared after a few minutes.
@ -171,5 +159,6 @@ Notice that just setting the background in the CSS does not have the desired eff
[local-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage [local-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
[session-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage [session-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
[indexed-db]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API [indexed-db]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
[message-port]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
[browser-window]: api/browser-window.md [browser-window]: api/browser-window.md
[subpixel rendering example]: images/subpixel-rendering-screenshot.gif [subpixel rendering example]: images/subpixel-rendering-screenshot.gif