chore: disallow shortcut reference links in docs Markdown (#36860)
* chore: disallow shortcut reference links in docs Markdown * docs: clean up shortcut-style links
This commit is contained in:
parent
a9e7bb0027
commit
d94f35a8f6
38 changed files with 199 additions and 171 deletions
|
@ -84,16 +84,16 @@ Examples of valid `color` values:
|
||||||
* #ffffff (RRGGBB)
|
* #ffffff (RRGGBB)
|
||||||
* #ffffffff (AARRGGBB)
|
* #ffffffff (AARRGGBB)
|
||||||
* RGB
|
* RGB
|
||||||
* rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)
|
* rgb\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+)\)
|
||||||
* e.g. rgb(255, 255, 255)
|
* e.g. rgb(255, 255, 255)
|
||||||
* RGBA
|
* RGBA
|
||||||
* rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)
|
* rgba\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+),\s*(\[\d.]+)\)
|
||||||
* e.g. rgba(255, 255, 255, 1.0)
|
* e.g. rgba(255, 255, 255, 1.0)
|
||||||
* HSL
|
* HSL
|
||||||
* hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)
|
* hsl\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%\)
|
||||||
* e.g. hsl(200, 20%, 50%)
|
* e.g. hsl(200, 20%, 50%)
|
||||||
* HSLA
|
* HSLA
|
||||||
* hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)
|
* hsla\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%,\s*(\[\d.]+)\)
|
||||||
* e.g. hsla(200, 20%, 50%, 0.5)
|
* e.g. hsla(200, 20%, 50%, 0.5)
|
||||||
* Color name
|
* Color name
|
||||||
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
|
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
|
||||||
|
|
|
@ -1048,16 +1048,16 @@ Examples of valid `backgroundColor` values:
|
||||||
* #ffffff (RGB)
|
* #ffffff (RGB)
|
||||||
* #ffffffff (ARGB)
|
* #ffffffff (ARGB)
|
||||||
* RGB
|
* RGB
|
||||||
* rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)
|
* rgb\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+)\)
|
||||||
* e.g. rgb(255, 255, 255)
|
* e.g. rgb(255, 255, 255)
|
||||||
* RGBA
|
* RGBA
|
||||||
* rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)
|
* rgba\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+),\s*(\[\d.]+)\)
|
||||||
* e.g. rgba(255, 255, 255, 1.0)
|
* e.g. rgba(255, 255, 255, 1.0)
|
||||||
* HSL
|
* HSL
|
||||||
* hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)
|
* hsl\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%\)
|
||||||
* e.g. hsl(200, 20%, 50%)
|
* e.g. hsl(200, 20%, 50%)
|
||||||
* HSLA
|
* HSLA
|
||||||
* hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)
|
* hsla\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%,\s*(\[\d.]+)\)
|
||||||
* e.g. hsla(200, 20%, 50%, 0.5)
|
* e.g. hsla(200, 20%, 50%, 0.5)
|
||||||
* Color name
|
* Color name
|
||||||
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
|
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
|
||||||
|
@ -1541,7 +1541,7 @@ Remove the window's menu bar.
|
||||||
* `options` Object (optional)
|
* `options` Object (optional)
|
||||||
* `mode` string _Windows_ - Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or `paused`.
|
* `mode` string _Windows_ - Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or `paused`.
|
||||||
|
|
||||||
Sets progress value in progress bar. Valid range is [0, 1.0].
|
Sets progress value in progress bar. Valid range is \[0, 1.0].
|
||||||
|
|
||||||
Remove progress bar when progress < 0;
|
Remove progress bar when progress < 0;
|
||||||
Change to indeterminate mode when progress > 1.
|
Change to indeterminate mode when progress > 1.
|
||||||
|
@ -1587,7 +1587,7 @@ Returns `boolean` - Whether the window has a shadow.
|
||||||
* `opacity` number - between 0.0 (fully transparent) and 1.0 (fully opaque)
|
* `opacity` number - between 0.0 (fully transparent) and 1.0 (fully opaque)
|
||||||
|
|
||||||
Sets the opacity of the window. On Linux, does nothing. Out of bound number
|
Sets the opacity of the window. On Linux, does nothing. Out of bound number
|
||||||
values are clamped to the [0, 1] range.
|
values are clamped to the \[0, 1] range.
|
||||||
|
|
||||||
#### `win.getOpacity()`
|
#### `win.getOpacity()`
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ throttling in one window, you can take the hack of
|
||||||
|
|
||||||
Forces the maximum disk space to be used by the disk cache, in bytes.
|
Forces the maximum disk space to be used by the disk cache, in bytes.
|
||||||
|
|
||||||
### --enable-logging[=file]
|
### --enable-logging\[=file]
|
||||||
|
|
||||||
Prints Chromium's logging to stderr (or a log file).
|
Prints Chromium's logging to stderr (or a log file).
|
||||||
|
|
||||||
|
@ -241,19 +241,19 @@ Electron supports some of the [CLI flags][node-cli] supported by Node.js.
|
||||||
|
|
||||||
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
**Note:** Passing unsupported command line switches to Electron when it is not running in `ELECTRON_RUN_AS_NODE` will have no effect.
|
||||||
|
|
||||||
### --inspect-brk[=[host:]port]
|
### --inspect-brk\[=\[host:]port]
|
||||||
|
|
||||||
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
|
Activate inspector on host:port and break at start of user script. Default host:port is 127.0.0.1:9229.
|
||||||
|
|
||||||
Aliased to `--debug-brk=[host:]port`.
|
Aliased to `--debug-brk=[host:]port`.
|
||||||
|
|
||||||
### --inspect-port=[host:]port
|
### --inspect-port=\[host:]port
|
||||||
|
|
||||||
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
|
Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the SIGUSR1 signal. Default host is `127.0.0.1`.
|
||||||
|
|
||||||
Aliased to `--debug-port=[host:]port`.
|
Aliased to `--debug-port=[host:]port`.
|
||||||
|
|
||||||
### --inspect[=[host:]port]
|
### --inspect\[=\[host:]port]
|
||||||
|
|
||||||
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
|
Activate inspector on `host:port`. Default is `127.0.0.1:9229`.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# desktopCapturer
|
# desktopCapturer
|
||||||
|
|
||||||
> Access information about media sources that can be used to capture audio and
|
> Access information about media sources that can be used to capture audio and
|
||||||
> video from the desktop using the [`navigator.mediaDevices.getUserMedia`] API.
|
> video from the desktop using the [`navigator.mediaDevices.getUserMedia`][] API.
|
||||||
|
|
||||||
Process: [Main](../glossary.md#main-process)
|
Process: [Main](../glossary.md#main-process)
|
||||||
|
|
||||||
|
@ -59,11 +59,11 @@ function handleError (e) {
|
||||||
```
|
```
|
||||||
|
|
||||||
To capture video from a source provided by `desktopCapturer` the constraints
|
To capture video from a source provided by `desktopCapturer` the constraints
|
||||||
passed to [`navigator.mediaDevices.getUserMedia`] must include
|
passed to [`navigator.mediaDevices.getUserMedia`][] must include
|
||||||
`chromeMediaSource: 'desktop'`, and `audio: false`.
|
`chromeMediaSource: 'desktop'`, and `audio: false`.
|
||||||
|
|
||||||
To capture both audio and video from the entire desktop the constraints passed
|
To capture both audio and video from the entire desktop the constraints passed
|
||||||
to [`navigator.mediaDevices.getUserMedia`] must include `chromeMediaSource: 'desktop'`,
|
to [`navigator.mediaDevices.getUserMedia`][] must include `chromeMediaSource: 'desktop'`,
|
||||||
for both `audio` and `video`, but should not include a `chromeMediaSourceId` constraint.
|
for both `audio` and `video`, but should not include a `chromeMediaSourceId` constraint.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
@ -101,7 +101,7 @@ The `desktopCapturer` module has the following methods:
|
||||||
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
|
Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`DesktopCapturerSource`](structures/desktop-capturer-source.md) objects, each `DesktopCapturerSource` represents a screen or an individual window that can be captured.
|
||||||
|
|
||||||
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
**Note** Capturing the screen contents requires user consent on macOS 10.15 Catalina or higher,
|
||||||
which can detected by [`systemPreferences.getMediaAccessStatus`].
|
which can detected by [`systemPreferences.getMediaAccessStatus`][].
|
||||||
|
|
||||||
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
|
||||||
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-windows-macos
|
[`systemPreferences.getMediaAccessStatus`]: system-preferences.md#systempreferencesgetmediaaccessstatusmediatype-windows-macos
|
||||||
|
|
|
@ -16,7 +16,7 @@ process, it handles asynchronous and synchronous messages sent from a renderer
|
||||||
process (web page). Messages sent from a renderer will be emitted to this
|
process (web page). Messages sent from a renderer will be emitted to this
|
||||||
module.
|
module.
|
||||||
|
|
||||||
For usage examples, check out the [IPC tutorial].
|
For usage examples, check out the [IPC tutorial][].
|
||||||
|
|
||||||
## Sending messages
|
## Sending messages
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ Returns `any` - The value sent back by the [`ipcMain`](./ipc-main.md) handler.
|
||||||
|
|
||||||
Send a message to the main process via `channel` and expect a result
|
Send a message to the main process via `channel` and expect a result
|
||||||
synchronously. Arguments will be serialized with the [Structured Clone
|
synchronously. Arguments will be serialized with the [Structured Clone
|
||||||
Algorithm][SCA], just like [`window.postMessage`], so prototype chains will not be
|
Algorithm][SCA], just like [`window.postMessage`][], so prototype chains will not be
|
||||||
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will
|
||||||
throw an exception.
|
throw an exception.
|
||||||
|
|
||||||
|
|
|
@ -659,7 +659,7 @@ The `proxyBypassRules` is a comma separated list of rules described below:
|
||||||
Match URLs which are IP address literals.
|
Match URLs which are IP address literals.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
"127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
|
"127.0.1", "\[0:0::1]", "\[::1]", "http://\[::1]:99"
|
||||||
|
|
||||||
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
|
* `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ Some popular `key` and `type`s are:
|
||||||
|
|
||||||
* `key` string
|
* `key` string
|
||||||
* `type` Type - Can be `string`, `boolean`, `integer`, `float`, `double`, `url`, `array` or `dictionary`.
|
* `type` Type - Can be `string`, `boolean`, `integer`, `float`, `double`, `url`, `array` or `dictionary`.
|
||||||
* `value` UserDefaultTypes[Type]
|
* `value` UserDefaultTypes\[Type]
|
||||||
|
|
||||||
Set the value of `key` in `NSUserDefaults`.
|
Set the value of `key` in `NSUserDefaults`.
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ Process: [Main](../glossary.md#main-process)<br />
|
||||||
`stderr` to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported; `stdin` will
|
`stderr` to either `pipe`, `inherit` or `ignore`. Configuring `stdin` is not supported; `stdin` will
|
||||||
always be ignored.
|
always be ignored.
|
||||||
For example, the supported values will be processed as following:
|
For example, the supported values will be processed as following:
|
||||||
* `pipe`: equivalent to ['ignore', 'pipe', 'pipe'] (the default)
|
* `pipe`: equivalent to \['ignore', 'pipe', 'pipe'] (the default)
|
||||||
* `ignore`: equivalent to 'ignore', 'ignore', 'ignore']
|
* `ignore`: equivalent to \['ignore', 'ignore', 'ignore']
|
||||||
* `inherit`: equivalent to ['ignore', 'inherit', 'inherit']
|
* `inherit`: equivalent to \['ignore', 'inherit', 'inherit']
|
||||||
* `serviceName` string (optional) - Name of the process that will appear in `name` property of
|
* `serviceName` string (optional) - Name of the process that will appear in `name` property of
|
||||||
[`child-process-gone` event of `app`](app.md#event-child-process-gone).
|
[`child-process-gone` event of `app`](app.md#event-child-process-gone).
|
||||||
Default is `node.mojom.NodeService`.
|
Default is `node.mojom.NodeService`.
|
||||||
|
@ -90,7 +90,7 @@ the child process exits, then the value is `undefined` after the `exit` event is
|
||||||
#### `child.stdout`
|
#### `child.stdout`
|
||||||
|
|
||||||
A `NodeJS.ReadableStream | null` that represents the child process's stdout.
|
A `NodeJS.ReadableStream | null` that represents the child process's stdout.
|
||||||
If the child was spawned with options.stdio[1] set to anything other than 'pipe', then this will be `null`.
|
If the child was spawned with options.stdio\[1] set to anything other than 'pipe', then this will be `null`.
|
||||||
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -105,7 +105,7 @@ child.stdout.on('data', (data) => {
|
||||||
#### `child.stderr`
|
#### `child.stderr`
|
||||||
|
|
||||||
A `NodeJS.ReadableStream | null` that represents the child process's stderr.
|
A `NodeJS.ReadableStream | null` that represents the child process's stderr.
|
||||||
If the child was spawned with options.stdio[2] set to anything other than 'pipe', then this will be `null`.
|
If the child was spawned with options.stdio\[2] set to anything other than 'pipe', then this will be `null`.
|
||||||
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
When the child process exits, then the value is `null` after the `exit` event is emitted.
|
||||||
|
|
||||||
### Instance Events
|
### Instance Events
|
||||||
|
|
|
@ -570,7 +570,7 @@ Returns:
|
||||||
* `finalUpdate` boolean
|
* `finalUpdate` boolean
|
||||||
|
|
||||||
Emitted when a result is available for
|
Emitted when a result is available for
|
||||||
[`webContents.findInPage`] request.
|
[`webContents.findInPage`](#contentsfindinpagetext-options) request.
|
||||||
|
|
||||||
#### Event: 'media-started-playing'
|
#### Event: 'media-started-playing'
|
||||||
|
|
||||||
|
@ -1324,7 +1324,7 @@ can be obtained by subscribing to [`found-in-page`](web-contents.md#event-found-
|
||||||
#### `contents.stopFindInPage(action)`
|
#### `contents.stopFindInPage(action)`
|
||||||
|
|
||||||
* `action` string - Specifies the action to take place when ending
|
* `action` string - Specifies the action to take place when ending
|
||||||
[`webContents.findInPage`] request.
|
[`webContents.findInPage`](#contentsfindinpagetext-options) request.
|
||||||
* `clearSelection` - Clear the selection.
|
* `clearSelection` - Clear the selection.
|
||||||
* `keepSelection` - Translate the selection into a normal selection.
|
* `keepSelection` - Translate the selection into a normal selection.
|
||||||
* `activateSelection` - Focus and click the selection node.
|
* `activateSelection` - Focus and click the selection node.
|
||||||
|
@ -1712,7 +1712,7 @@ app.whenReady().then(() => {
|
||||||
|
|
||||||
#### `contents.sendToFrame(frameId, channel, ...args)`
|
#### `contents.sendToFrame(frameId, channel, ...args)`
|
||||||
|
|
||||||
* `frameId` Integer | [number, number] - the ID of the frame to send to, or a
|
* `frameId` Integer | \[number, number] - the ID of the frame to send to, or a
|
||||||
pair of `[processId, frameId]` if the frame is in a different process to the
|
pair of `[processId, frameId]` if the frame is in a different process to the
|
||||||
main frame.
|
main frame.
|
||||||
* `channel` string
|
* `channel` string
|
||||||
|
|
|
@ -609,7 +609,7 @@ examples.
|
||||||
|
|
||||||
### `<webview>.sendToFrame(frameId, channel, ...args)`
|
### `<webview>.sendToFrame(frameId, channel, ...args)`
|
||||||
|
|
||||||
* `frameId` [number, number] - `[processId, frameId]`
|
* `frameId` \[number, number] - `[processId, frameId]`
|
||||||
* `channel` string
|
* `channel` string
|
||||||
* `...args` any[]
|
* `...args` any[]
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ webview.addEventListener('close', () => {
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
* `frameId` [number, number] - pair of `[processId, frameId]`.
|
* `frameId` \[number, number] - pair of `[processId, frameId]`.
|
||||||
* `channel` string
|
* `channel` string
|
||||||
* `args` any[]
|
* `args` any[]
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ See `gn help gen` for more information on generating IDE projects with GN.
|
||||||
|
|
||||||
Launch Electron app after build.
|
Launch Electron app after build.
|
||||||
You can now open the xcode workspace created above and attach to the Electron process
|
You can now open the xcode workspace created above and attach to the Electron process
|
||||||
through the Debug > Attach To Process > Electron debug menu. [Note: If you want to debug
|
through the Debug > Attach To Process > Electron debug menu. \[Note: If you want to debug
|
||||||
the renderer process, you need to attach to the Electron Helper as well.]
|
the renderer process, you need to attach to the Electron Helper as well.]
|
||||||
|
|
||||||
You can now set breakpoints in any of the indexed files. However, you will not be able
|
You can now set breakpoints in any of the indexed files. However, you will not be able
|
||||||
|
|
|
@ -4,7 +4,7 @@ This page defines some terminology that is commonly used in Electron development
|
||||||
|
|
||||||
### ASAR
|
### ASAR
|
||||||
|
|
||||||
ASAR stands for Atom Shell Archive Format. An [asar] archive is a simple
|
ASAR stands for Atom Shell Archive Format. An [asar][] archive is a simple
|
||||||
`tar`-like format that concatenates files into a single file. Electron can read
|
`tar`-like format that concatenates files into a single file. Electron can read
|
||||||
arbitrary files from it without unpacking the whole file.
|
arbitrary files from it without unpacking the whole file.
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ macOS implement their own version of code signing. As a desktop app developer,
|
||||||
it's important that you sign your code if you plan on distributing it to the
|
it's important that you sign your code if you plan on distributing it to the
|
||||||
general public.
|
general public.
|
||||||
|
|
||||||
For more information, read the [Code Signing] tutorial.
|
For more information, read the [Code Signing][] tutorial.
|
||||||
|
|
||||||
### context isolation
|
### context isolation
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ contents in your renderer process. With context isolation enabled, the
|
||||||
only way to expose APIs from your preload script is through the
|
only way to expose APIs from your preload script is through the
|
||||||
`contextBridge` API.
|
`contextBridge` API.
|
||||||
|
|
||||||
For more information, read the [Context Isolation] tutorial.
|
For more information, read the [Context Isolation][] tutorial.
|
||||||
|
|
||||||
See also: [preload script](#preload-script), [renderer process](#renderer-process)
|
See also: [preload script](#preload-script), [renderer process](#renderer-process)
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ See also: [process](#process), [renderer process](#renderer-process)
|
||||||
### MAS
|
### MAS
|
||||||
|
|
||||||
Acronym for Apple's Mac App Store. For details on submitting your app to the
|
Acronym for Apple's Mac App Store. For details on submitting your app to the
|
||||||
MAS, see the [Mac App Store Submission Guide].
|
MAS, see the [Mac App Store Submission Guide][].
|
||||||
|
|
||||||
### Mojo
|
### Mojo
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ More information can be found in [Microsoft's documentation][msi].
|
||||||
|
|
||||||
### native modules
|
### native modules
|
||||||
|
|
||||||
Native modules (also called [addons] in
|
Native modules (also called [addons][] in
|
||||||
Node.js) are modules written in C or C++ that can be loaded into Node.js or
|
Node.js) are modules written in C or C++ that can be loaded into Node.js or
|
||||||
Electron using the require() function, and used as if they were an
|
Electron using the require() function, and used as if they were an
|
||||||
ordinary Node.js module. They are used primarily to provide an interface
|
ordinary Node.js module. They are used primarily to provide an interface
|
||||||
|
@ -116,7 +116,7 @@ likely to use a different V8 version from the Node binary installed in your
|
||||||
system, you have to manually specify the location of Electron’s headers when
|
system, you have to manually specify the location of Electron’s headers when
|
||||||
building native modules.
|
building native modules.
|
||||||
|
|
||||||
For more information, read the [Native Node Modules] tutorial.
|
For more information, read the [Native Node Modules][] tutorial.
|
||||||
|
|
||||||
### notarization
|
### notarization
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ OSR (offscreen rendering) can be used for loading heavy page in
|
||||||
background and then displaying it after (it will be much faster).
|
background and then displaying it after (it will be much faster).
|
||||||
It allows you to render page without showing it on screen.
|
It allows you to render page without showing it on screen.
|
||||||
|
|
||||||
For more information, read the [Offscreen Rendering] tutorial.
|
For more information, read the [Offscreen Rendering][] tutorial.
|
||||||
|
|
||||||
### preload script
|
### preload script
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ See also: [renderer process](#renderer-process), [context isolation](#context-is
|
||||||
### process
|
### process
|
||||||
|
|
||||||
A process is an instance of a computer program that is being executed. Electron
|
A process is an instance of a computer program that is being executed. Electron
|
||||||
apps that make use of the [main] and one or many [renderer] process are
|
apps that make use of the [main][] and one or many [renderer][] process are
|
||||||
actually running several programs simultaneously.
|
actually running several programs simultaneously.
|
||||||
|
|
||||||
In Node.js and Electron, each running process has a `process` object. This
|
In Node.js and Electron, each running process has a `process` object. This
|
||||||
|
@ -169,14 +169,14 @@ See also: [process](#process), [main process](#main-process)
|
||||||
The sandbox is a security feature inherited from Chromium that restricts
|
The sandbox is a security feature inherited from Chromium that restricts
|
||||||
your renderer processes to a limited set of permissions.
|
your renderer processes to a limited set of permissions.
|
||||||
|
|
||||||
For more information, read the [Process Sandboxing] tutorial.
|
For more information, read the [Process Sandboxing][] tutorial.
|
||||||
|
|
||||||
See also: [process](#process)
|
See also: [process](#process)
|
||||||
|
|
||||||
### Squirrel
|
### Squirrel
|
||||||
|
|
||||||
Squirrel is an open-source framework that enables Electron apps to update
|
Squirrel is an open-source framework that enables Electron apps to update
|
||||||
automatically as new versions are released. See the [autoUpdater] API for
|
automatically as new versions are released. See the [autoUpdater][] API for
|
||||||
info about getting started with Squirrel.
|
info about getting started with Squirrel.
|
||||||
|
|
||||||
### userland
|
### userland
|
||||||
|
|
|
@ -113,13 +113,13 @@ Using `autoUpdater` as an example:
|
||||||
* [Instance Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods)
|
* [Instance Methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Prototype_methods)
|
||||||
must be listed under an `### Instance Methods` chapter.
|
must be listed under an `### Instance Methods` chapter.
|
||||||
* All methods that have a return value must start their description with
|
* All methods that have a return value must start their description with
|
||||||
"Returns `[TYPE]` - [Return description]"
|
"Returns `[TYPE]` - \[Return description]"
|
||||||
* If the method returns an `Object`, its structure can be specified using a colon
|
* If the method returns an `Object`, its structure can be specified using a colon
|
||||||
followed by a newline then an unordered list of properties in the same style as
|
followed by a newline then an unordered list of properties in the same style as
|
||||||
function parameters.
|
function parameters.
|
||||||
* Instance Events must be listed under an `### Instance Events` chapter.
|
* Instance Events must be listed under an `### Instance Events` chapter.
|
||||||
* Instance Properties must be listed under an `### Instance Properties` chapter.
|
* Instance Properties must be listed under an `### Instance Properties` chapter.
|
||||||
* Instance Properties must start with "A [Property Type] ..."
|
* Instance Properties must start with "A \[Property Type] ..."
|
||||||
|
|
||||||
Using the `Session` and `Cookies` classes as an example:
|
Using the `Session` and `Cookies` classes as an example:
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ will then be your distribution to deliver to users.
|
||||||
### With an app source code archive (asar)
|
### With an app source code archive (asar)
|
||||||
|
|
||||||
Instead of shipping your app by copying all of its source files, you can
|
Instead of shipping your app by copying all of its source files, you can
|
||||||
package your app into an [asar] archive to improve the performance of reading
|
package your app into an [asar][] archive to improve the performance of reading
|
||||||
files on platforms like Windows, if you are not already using a bundler such
|
files on platforms like Windows, if you are not already using a bundler such
|
||||||
as Parcel or Webpack.
|
as Parcel or Webpack.
|
||||||
|
|
||||||
|
|
|
@ -117,9 +117,9 @@ driver.quit()
|
||||||
## Using Playwright
|
## Using Playwright
|
||||||
|
|
||||||
[Microsoft Playwright](https://playwright.dev) is an end-to-end testing framework built
|
[Microsoft Playwright](https://playwright.dev) is an end-to-end testing framework built
|
||||||
using browser-specific remote debugging protocols, similar to the [Puppeteer] headless
|
using browser-specific remote debugging protocols, similar to the [Puppeteer][] headless
|
||||||
Node.js API but geared towards end-to-end testing. Playwright has experimental Electron
|
Node.js API but geared towards end-to-end testing. Playwright has experimental Electron
|
||||||
support via Electron's support for the [Chrome DevTools Protocol] (CDP).
|
support via Electron's support for the [Chrome DevTools Protocol][] (CDP).
|
||||||
|
|
||||||
### Install dependencies
|
### Install dependencies
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ your app isn't doing anything to endanger its users.
|
||||||
To start the process, ensure that you fulfill the requirements for signing and
|
To start the process, ensure that you fulfill the requirements for signing and
|
||||||
notarizing your app:
|
notarizing your app:
|
||||||
|
|
||||||
1. Enroll in the [Apple Developer Program] (requires an annual fee)
|
1. Enroll in the [Apple Developer Program][] (requires an annual fee)
|
||||||
2. Download and install [Xcode] - this requires a computer running macOS
|
2. Download and install [Xcode][] - this requires a computer running macOS
|
||||||
3. Generate, download, and install [signing certificates]
|
3. Generate, download, and install [signing certificates][]
|
||||||
|
|
||||||
Electron's ecosystem favors configuration and freedom, so there are multiple
|
Electron's ecosystem favors configuration and freedom, so there are multiple
|
||||||
ways to get your application signed and notarized.
|
ways to get your application signed and notarized.
|
||||||
|
@ -51,8 +51,8 @@ ways to get your application signed and notarized.
|
||||||
|
|
||||||
If you're using Electron's favorite build tool, getting your application signed
|
If you're using Electron's favorite build tool, getting your application signed
|
||||||
and notarized requires a few additions to your configuration. [Forge](https://electronforge.io) is a
|
and notarized requires a few additions to your configuration. [Forge](https://electronforge.io) is a
|
||||||
collection of the official Electron tools, using [`electron-packager`],
|
collection of the official Electron tools, using [`electron-packager`][],
|
||||||
[`@electron/osx-sign`], and [`@electron/notarize`] under the hood.
|
[`@electron/osx-sign`][], and [`@electron/notarize`][] under the hood.
|
||||||
|
|
||||||
Detailed instructions on how to configure your application can be found in the
|
Detailed instructions on how to configure your application can be found in the
|
||||||
[Signing macOS Apps](https://www.electronforge.io/guides/code-signing/code-signing-macos) guide in
|
[Signing macOS Apps](https://www.electronforge.io/guides/code-signing/code-signing-macos) guide in
|
||||||
|
@ -61,8 +61,8 @@ the Electron Forge docs.
|
||||||
### Using Electron Packager
|
### Using Electron Packager
|
||||||
|
|
||||||
If you're not using an integrated build pipeline like Forge, you
|
If you're not using an integrated build pipeline like Forge, you
|
||||||
are likely using [`electron-packager`], which includes [`@electron/osx-sign`] and
|
are likely using [`electron-packager`][], which includes [`@electron/osx-sign`][] and
|
||||||
[`@electron/notarize`].
|
[`@electron/notarize`][].
|
||||||
|
|
||||||
If you're using Packager's API, you can pass [in configuration that both signs
|
If you're using Packager's API, you can pass [in configuration that both signs
|
||||||
and notarizes your application](https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html).
|
and notarizes your application](https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html).
|
||||||
|
@ -82,7 +82,7 @@ packager({
|
||||||
|
|
||||||
### Signing Mac App Store applications
|
### Signing Mac App Store applications
|
||||||
|
|
||||||
See the [Mac App Store Guide].
|
See the [Mac App Store Guide][].
|
||||||
|
|
||||||
## Signing Windows builds
|
## Signing Windows builds
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ Electron Forge is the recommended way to sign your `Squirrel.Windows` and `WiX M
|
||||||
|
|
||||||
### Using electron-winstaller (Squirrel.Windows)
|
### Using electron-winstaller (Squirrel.Windows)
|
||||||
|
|
||||||
[`electron-winstaller`] is a package that can generate Squirrel.Windows installers for your
|
[`electron-winstaller`][] is a package that can generate Squirrel.Windows installers for your
|
||||||
Electron app. This is the tool used under the hood by Electron Forge's
|
Electron app. This is the tool used under the hood by Electron Forge's
|
||||||
[Squirrel.Windows Maker][maker-squirrel]. If you're not using Electron Forge and want to use
|
[Squirrel.Windows Maker][maker-squirrel]. If you're not using Electron Forge and want to use
|
||||||
`electron-winstaller` directly, use the `certificateFile` and `certificatePassword` configuration
|
`electron-winstaller` directly, use the `certificateFile` and `certificatePassword` configuration
|
||||||
|
@ -135,16 +135,16 @@ try {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
For full configuration options, check out the [`electron-winstaller`] repository!
|
For full configuration options, check out the [`electron-winstaller`][] repository!
|
||||||
|
|
||||||
### Using electron-wix-msi (WiX MSI)
|
### Using electron-wix-msi (WiX MSI)
|
||||||
|
|
||||||
[`electron-wix-msi`] is a package that can generate MSI installers for your
|
[`electron-wix-msi`][] is a package that can generate MSI installers for your
|
||||||
Electron app. This is the tool used under the hood by Electron Forge's [MSI Maker][maker-msi].
|
Electron app. This is the tool used under the hood by Electron Forge's [MSI Maker][maker-msi].
|
||||||
|
|
||||||
If you're not using Electron Forge and want to use `electron-wix-msi` directly, use the
|
If you're not using Electron Forge and want to use `electron-wix-msi` directly, use the
|
||||||
`certificateFile` and `certificatePassword` configuration options
|
`certificateFile` and `certificatePassword` configuration options
|
||||||
or pass in parameters directly to [SignTool.exe] with the `signWithParams` option.
|
or pass in parameters directly to [SignTool.exe][] with the `signWithParams` option.
|
||||||
|
|
||||||
```js {12-13}
|
```js {12-13}
|
||||||
import { MSICreator } from 'electron-wix-msi'
|
import { MSICreator } from 'electron-wix-msi'
|
||||||
|
@ -177,7 +177,7 @@ supportBinaries.forEach(async (binary) => {
|
||||||
await msiCreator.compile()
|
await msiCreator.compile()
|
||||||
```
|
```
|
||||||
|
|
||||||
For full configuration options, check out the [`electron-wix-msi`] repository!
|
For full configuration options, check out the [`electron-wix-msi`][] repository!
|
||||||
|
|
||||||
### Using Electron Builder
|
### Using Electron Builder
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ can find [its documentation here](https://www.electron.build/code-signing).
|
||||||
|
|
||||||
### Signing Windows Store applications
|
### Signing Windows Store applications
|
||||||
|
|
||||||
See the [Windows Store Guide].
|
See the [Windows Store Guide][].
|
||||||
|
|
||||||
[apple developer program]: https://developer.apple.com/programs/
|
[apple developer program]: https://developer.apple.com/programs/
|
||||||
[`@electron/osx-sign`]: https://github.com/electron/osx-sign
|
[`@electron/osx-sign`]: https://github.com/electron/osx-sign
|
||||||
|
|
|
@ -72,7 +72,7 @@ contextBridge.exposeInMainWorld('myAPI', {
|
||||||
|
|
||||||
## Usage with TypeScript
|
## Usage with TypeScript
|
||||||
|
|
||||||
If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's `window` object won't have the correct typings unless you extend the types with a [declaration file].
|
If you're building your Electron app with TypeScript, you'll want to add types to your APIs exposed over the context bridge. The renderer's `window` object won't have the correct typings unless you extend the types with a [declaration file][].
|
||||||
|
|
||||||
For example, given this `preload.ts` script:
|
For example, given this `preload.ts` script:
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ from the OS.
|
||||||
|
|
||||||
If your app has its own dark mode, you should toggle it on and off in sync with
|
If your app has its own dark mode, you should toggle it on and off in sync with
|
||||||
the system's dark mode setting. You can do this by using the
|
the system's dark mode setting. You can do this by using the
|
||||||
[prefers-color-scheme] CSS media query.
|
[prefers-color-scheme][] CSS media query.
|
||||||
|
|
||||||
### Manually update your own interfaces
|
### Manually update your own interfaces
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@ guide!).
|
||||||
|
|
||||||
| Guide | Description |
|
| Guide | Description |
|
||||||
| :-------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
| :-------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||||
| [Message ports] | This guide provides some examples of how you might use MessagePorts in your app to communicate different processes. |
|
| [Message ports][] | This guide provides some examples of how you might use MessagePorts in your app to communicate different processes. |
|
||||||
| [Device access] | Learn how to access the device hardware (Bluetooth, USB, Serial). |
|
| [Device access][] | Learn how to access the device hardware (Bluetooth, USB, Serial). |
|
||||||
| [Keyboard shortcuts] | Configure local and global keyboard shortcuts for your Electron application. |
|
| [Keyboard shortcuts][] | Configure local and global keyboard shortcuts for your Electron application. |
|
||||||
| [Multithreading] | With Web Workers, it is possible to run JavaScript in OS-level threads |
|
| [Multithreading][] | With Web Workers, it is possible to run JavaScript in OS-level threads |
|
||||||
| [Offscreen rendering] | Offscreen rendering lets you obtain the content of a BrowserWindow in a bitmap, so it can be rendered anywhere. |
|
| [Offscreen rendering][] | Offscreen rendering lets you obtain the content of a BrowserWindow in a bitmap, so it can be rendered anywhere. |
|
||||||
| [Spellchecker] | Learn how to use the built-in spellchecker, set languages, etc. |
|
| [Spellchecker][] | Learn how to use the built-in spellchecker, set languages, etc. |
|
||||||
| [Web embeds] | Discover the different ways to embed third-party web content in your application. |
|
| [Web embeds][] | Discover the different ways to embed third-party web content in your application. |
|
||||||
|
|
||||||
<!-- guide-table-end -->
|
<!-- guide-table-end -->
|
||||||
|
|
||||||
|
@ -55,3 +55,10 @@ our [Discord server][discord] and let us know!
|
||||||
[app]: ../api/app.md
|
[app]: ../api/app.md
|
||||||
[discord]: https://discord.gg/electronjs
|
[discord]: https://discord.gg/electronjs
|
||||||
[fiddle]: https://www.electronjs.org/fiddle
|
[fiddle]: https://www.electronjs.org/fiddle
|
||||||
|
[Message ports]: ./message-ports.md
|
||||||
|
[Device access]: ./devices.md
|
||||||
|
[Keyboard shortcuts]: ./keyboard-shortcuts.md
|
||||||
|
[Multithreading]: ./multithreading.md
|
||||||
|
[Offscreen rendering]: ./offscreen-rendering.md
|
||||||
|
[Spellchecker]: ./spellchecker.md
|
||||||
|
[Web embeds]: ./web-embeds.md
|
||||||
|
|
|
@ -6,23 +6,23 @@ a single extensible interface so that anyone can jump right into making Electron
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
The [Electron Forge docs] contain detailed information on taking your application
|
The [Electron Forge docs][] contain detailed information on taking your application
|
||||||
from source code to your end users' machines.
|
from source code to your end users' machines.
|
||||||
This includes:
|
This includes:
|
||||||
|
|
||||||
* Packaging your application [(package)]
|
* Packaging your application [(package)][]
|
||||||
* Generating executables and installers for each OS [(make)], and,
|
* Generating executables and installers for each OS [(make)][], and,
|
||||||
* Publishing these files to online platforms to download [(publish)].
|
* Publishing these files to online platforms to download [(publish)][].
|
||||||
|
|
||||||
For beginners, we recommend following through Electron's [tutorial] to develop, build,
|
For beginners, we recommend following through Electron's [tutorial][] to develop, build,
|
||||||
package and publish your first Electron app. If you have already developed an app on your machine
|
package and publish your first Electron app. If you have already developed an app on your machine
|
||||||
and want to start on packaging and distribution, start from [step 5] of the tutorial.
|
and want to start on packaging and distribution, start from [step 5][] of the tutorial.
|
||||||
|
|
||||||
## Getting help
|
## Getting help
|
||||||
|
|
||||||
* If you need help with developing your app, our [community Discord server][discord] is a great place
|
* If you need help with developing your app, our [community Discord server][discord] is a great place
|
||||||
to get advice from other Electron app developers.
|
to get advice from other Electron app developers.
|
||||||
* If you suspect you're running into a bug with Forge, please check the [GitHub issue tracker]
|
* If you suspect you're running into a bug with Forge, please check the [GitHub issue tracker][]
|
||||||
to see if any existing issues match your problem. If not, feel free to fill out our bug report
|
to see if any existing issues match your problem. If not, feel free to fill out our bug report
|
||||||
template and submit a new issue.
|
template and submit a new issue.
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ experience required.
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
We recommend you to start with the [tutorial], which guides you through the
|
We recommend you to start with the [tutorial][], which guides you through the
|
||||||
process of developing an Electron app and distributing it to users.
|
process of developing an Electron app and distributing it to users.
|
||||||
The [examples] and [API documentation] are also good places to browse around
|
The [examples][] and [API documentation][] are also good places to browse around
|
||||||
and discover new things.
|
and discover new things.
|
||||||
|
|
||||||
## Running examples with Electron Fiddle
|
## Running examples with Electron Fiddle
|
||||||
|
|
|
@ -15,7 +15,7 @@ native API from your UI or triggering changes in your web contents from native m
|
||||||
## IPC channels
|
## IPC channels
|
||||||
|
|
||||||
In Electron, processes communicate by passing messages through developer-defined "channels"
|
In Electron, processes communicate by passing messages through developer-defined "channels"
|
||||||
with the [`ipcMain`] and [`ipcRenderer`] modules. These channels are
|
with the [`ipcMain`][] and [`ipcRenderer`][] modules. These channels are
|
||||||
**arbitrary** (you can name them anything you want) and **bidirectional** (you can use the
|
**arbitrary** (you can name them anything you want) and **bidirectional** (you can use the
|
||||||
same channel name for both modules).
|
same channel name for both modules).
|
||||||
|
|
||||||
|
@ -25,16 +25,16 @@ you can use as a reference for your app code.
|
||||||
## Understanding context-isolated processes
|
## Understanding context-isolated processes
|
||||||
|
|
||||||
Before proceeding to implementation details, you should be familiar with the idea of using a
|
Before proceeding to implementation details, you should be familiar with the idea of using a
|
||||||
[preload script] to import Node.js and Electron modules in a context-isolated renderer process.
|
[preload script][] to import Node.js and Electron modules in a context-isolated renderer process.
|
||||||
|
|
||||||
* For a full overview of Electron's process model, you can read the [process model docs].
|
* For a full overview of Electron's process model, you can read the [process model docs][].
|
||||||
* For a primer into exposing APIs from your preload script using the `contextBridge` module, check
|
* For a primer into exposing APIs from your preload script using the `contextBridge` module, check
|
||||||
out the [context isolation tutorial].
|
out the [context isolation tutorial][].
|
||||||
|
|
||||||
## Pattern 1: Renderer to main (one-way)
|
## Pattern 1: Renderer to main (one-way)
|
||||||
|
|
||||||
To fire a one-way IPC message from a renderer process to the main process, you can use the
|
To fire a one-way IPC message from a renderer process to the main process, you can use the
|
||||||
[`ipcRenderer.send`] API to send a message that is then received by the [`ipcMain.on`] API.
|
[`ipcRenderer.send`][] API to send a message that is then received by the [`ipcMain.on`][] API.
|
||||||
|
|
||||||
You usually use this pattern to call a main process API from your web contents. We'll demonstrate
|
You usually use this pattern to call a main process API from your web contents. We'll demonstrate
|
||||||
this pattern by creating a simple app that can programmatically change its window title.
|
this pattern by creating a simple app that can programmatically change its window title.
|
||||||
|
@ -78,7 +78,7 @@ app.whenReady().then(() => {
|
||||||
//...
|
//...
|
||||||
```
|
```
|
||||||
|
|
||||||
The above `handleSetTitle` callback has two parameters: an [IpcMainEvent] structure and a
|
The above `handleSetTitle` callback has two parameters: an [IpcMainEvent][] structure and a
|
||||||
`title` string. Whenever a message comes through the `set-title` channel, this function will
|
`title` string. Whenever a message comes through the `set-title` channel, this function will
|
||||||
find the BrowserWindow instance attached to the message sender and use the `win.setTitle`
|
find the BrowserWindow instance attached to the message sender and use the `win.setTitle`
|
||||||
API on it.
|
API on it.
|
||||||
|
@ -108,7 +108,7 @@ At this point, you'll be able to use the `window.electronAPI.setTitle()` functio
|
||||||
process.
|
process.
|
||||||
|
|
||||||
:::caution Security warning
|
:::caution Security warning
|
||||||
We don't directly expose the whole `ipcRenderer.send` API for [security reasons]. Make sure to
|
We don't directly expose the whole `ipcRenderer.send` API for [security reasons][]. Make sure to
|
||||||
limit the renderer's access to Electron APIs as much as possible.
|
limit the renderer's access to Electron APIs as much as possible.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -153,8 +153,8 @@ to your BrowserWindow title!
|
||||||
## Pattern 2: Renderer to main (two-way)
|
## Pattern 2: Renderer to main (two-way)
|
||||||
|
|
||||||
A common application for two-way IPC is calling a main process module from your renderer process
|
A common application for two-way IPC is calling a main process module from your renderer process
|
||||||
code and waiting for a result. This can be done by using [`ipcRenderer.invoke`] paired with
|
code and waiting for a result. This can be done by using [`ipcRenderer.invoke`][] paired with
|
||||||
[`ipcMain.handle`].
|
[`ipcMain.handle`][].
|
||||||
|
|
||||||
In the following example, we'll be opening a native file dialog from the renderer process and
|
In the following example, we'll be opening a native file dialog from the renderer process and
|
||||||
returning the selected file's path.
|
returning the selected file's path.
|
||||||
|
@ -236,7 +236,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||||
```
|
```
|
||||||
|
|
||||||
:::caution Security warning
|
:::caution Security warning
|
||||||
We don't directly expose the whole `ipcRenderer.invoke` API for [security reasons]. Make sure to
|
We don't directly expose the whole `ipcRenderer.invoke` API for [security reasons][]. Make sure to
|
||||||
limit the renderer's access to Electron APIs as much as possible.
|
limit the renderer's access to Electron APIs as much as possible.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ renderer process until a reply is received.
|
||||||
|
|
||||||
When sending a message from the main process to a renderer process, you need to specify which
|
When sending a message from the main process to a renderer process, you need to specify which
|
||||||
renderer is receiving the message. Messages need to be sent to a renderer process
|
renderer is receiving the message. Messages need to be sent to a renderer process
|
||||||
via its [`WebContents`] instance. This WebContents instance contains a [`send`][webcontents-send] method
|
via its [`WebContents`][] instance. This WebContents instance contains a [`send`][webcontents-send] method
|
||||||
that can be used in the same way as `ipcRenderer.send`.
|
that can be used in the same way as `ipcRenderer.send`.
|
||||||
|
|
||||||
To demonstrate this pattern, we'll be building a number counter controlled by the native operating
|
To demonstrate this pattern, we'll be building a number counter controlled by the native operating
|
||||||
|
@ -440,7 +440,7 @@ After loading the preload script, your renderer process should have access to th
|
||||||
`window.electronAPI.onUpdateCounter()` listener function.
|
`window.electronAPI.onUpdateCounter()` listener function.
|
||||||
|
|
||||||
:::caution Security warning
|
:::caution Security warning
|
||||||
We don't directly expose the whole `ipcRenderer.on` API for [security reasons]. Make sure to
|
We don't directly expose the whole `ipcRenderer.on` API for [security reasons][]. Make sure to
|
||||||
limit the renderer's access to Electron APIs as much as possible.
|
limit the renderer's access to Electron APIs as much as possible.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ and `ipcRenderer` modules. To achieve this, you have two options:
|
||||||
|
|
||||||
* Use the main process as a message broker between renderers. This would involve sending a message
|
* Use the main process as a message broker between renderers. This would involve sending a message
|
||||||
from one renderer to the main process, which would forward the message to the other renderer.
|
from one renderer to the main process, which would forward the message to the other renderer.
|
||||||
* Pass a [MessagePort] from the main process to both renderers. This will allow direct communication
|
* Pass a [MessagePort][] from the main process to both renderers. This will allow direct communication
|
||||||
between renderers after the initial setup.
|
between renderers after the initial setup.
|
||||||
|
|
||||||
## Object serialization
|
## Object serialization
|
||||||
|
|
|
@ -10,8 +10,8 @@ for your Electron application.
|
||||||
### Local Shortcuts
|
### Local Shortcuts
|
||||||
|
|
||||||
Local keyboard shortcuts are triggered only when the application is focused.
|
Local keyboard shortcuts are triggered only when the application is focused.
|
||||||
To configure a local keyboard shortcut, you need to specify an [`accelerator`]
|
To configure a local keyboard shortcut, you need to specify an [`accelerator`][]
|
||||||
property when creating a [MenuItem] within the [Menu] module.
|
property when creating a [MenuItem][] within the [Menu][] module.
|
||||||
|
|
||||||
Starting with a working application from the
|
Starting with a working application from the
|
||||||
[Quick Start Guide](quick-start.md), update the `main.js` file with the
|
[Quick Start Guide](quick-start.md), update the `main.js` file with the
|
||||||
|
@ -48,7 +48,7 @@ generated after triggering the `click` event: "Electron rocks!".
|
||||||
|
|
||||||
### Global Shortcuts
|
### Global Shortcuts
|
||||||
|
|
||||||
To configure a global keyboard shortcut, you need to use the [globalShortcut]
|
To configure a global keyboard shortcut, you need to use the [globalShortcut][]
|
||||||
module to detect keyboard events even when the application does not have
|
module to detect keyboard events even when the application does not have
|
||||||
keyboard focus.
|
keyboard focus.
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ you will see that Electron loves global shortcuts!
|
||||||
|
|
||||||
#### Using web APIs
|
#### Using web APIs
|
||||||
|
|
||||||
If you want to handle keyboard shortcuts within a [BrowserWindow], you can
|
If you want to handle keyboard shortcuts within a [BrowserWindow][], you can
|
||||||
listen for the `keyup` and `keydown` [DOM events][dom-events] inside the
|
listen for the `keyup` and `keydown` [DOM events][dom-events] inside the
|
||||||
renderer process using the [addEventListener() API][addEventListener-api].
|
renderer process using the [addEventListener() API][addEventListener-api].
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ see that this key combination was successfully intercepted.
|
||||||
#### Using third-party libraries
|
#### Using third-party libraries
|
||||||
|
|
||||||
If you don't want to do manual shortcut parsing, there are libraries that do
|
If you don't want to do manual shortcut parsing, there are libraries that do
|
||||||
advanced key detection, such as [mousetrap]. Below are examples of usage of the
|
advanced key detection, such as [mousetrap][]. Below are examples of usage of the
|
||||||
`mousetrap` running in the Renderer process:
|
`mousetrap` running in the Renderer process:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
|
@ -11,7 +11,7 @@ This guide provides information on:
|
||||||
To sign Electron apps, the following tools must be installed first:
|
To sign Electron apps, the following tools must be installed first:
|
||||||
|
|
||||||
* Xcode 11 or above.
|
* Xcode 11 or above.
|
||||||
* The [@electron/osx-sign] npm module.
|
* The [@electron/osx-sign][] npm module.
|
||||||
|
|
||||||
You also have to register an Apple Developer account and join the
|
You also have to register an Apple Developer account and join the
|
||||||
[Apple Developer Program][developer-program].
|
[Apple Developer Program][developer-program].
|
||||||
|
|
|
@ -18,7 +18,7 @@ An example demonstrating how you can create a file on the fly to be dragged out
|
||||||
|
|
||||||
### Preload.js
|
### Preload.js
|
||||||
|
|
||||||
In `preload.js` use the [`contextBridge`] to inject a method `window.electron.startDrag(...)` that will send an IPC message to the main process.
|
In `preload.js` use the [`contextBridge`][] to inject a method `window.electron.startDrag(...)` that will send an IPC message to the main process.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { contextBridge, ipcRenderer } = require('electron')
|
const { contextBridge, ipcRenderer } = require('electron')
|
||||||
|
@ -41,7 +41,7 @@ Add a draggable element to `index.html`, and reference your renderer script:
|
||||||
|
|
||||||
### Renderer.js
|
### Renderer.js
|
||||||
|
|
||||||
In `renderer.js` set up the renderer process to handle drag events by calling the method you added via the [`contextBridge`] above.
|
In `renderer.js` set up the renderer process to handle drag events by calling the method you added via the [`contextBridge`][] above.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
document.getElementById('drag').ondragstart = (event) => {
|
document.getElementById('drag').ondragstart = (event) => {
|
||||||
|
|
|
@ -28,7 +28,7 @@ it also meant that one website crashing or hanging would affect the entire brows
|
||||||
To solve this problem, the Chrome team decided that each tab would render in its own
|
To solve this problem, the Chrome team decided that each tab would render in its own
|
||||||
process, limiting the harm that buggy or malicious code on a web page could cause to
|
process, limiting the harm that buggy or malicious code on a web page could cause to
|
||||||
the app as a whole. A single browser process then controls these processes, as well
|
the app as a whole. A single browser process then controls these processes, as well
|
||||||
as the application lifecycle as a whole. This diagram below from the [Chrome Comic]
|
as the application lifecycle as a whole. This diagram below from the [Chrome Comic][]
|
||||||
visualizes this model:
|
visualizes this model:
|
||||||
|
|
||||||
![Chrome's multi-process architecture](../images/chrome-processes.png)
|
![Chrome's multi-process architecture](../images/chrome-processes.png)
|
||||||
|
|
|
@ -49,7 +49,7 @@ continuing, we recommend the following resources:
|
||||||
|
|
||||||
### Code editor
|
### Code editor
|
||||||
|
|
||||||
You will need a text editor to write your code. We recommend using [Visual Studio Code],
|
You will need a text editor to write your code. We recommend using [Visual Studio Code][],
|
||||||
although you can choose whichever one you prefer.
|
although you can choose whichever one you prefer.
|
||||||
|
|
||||||
### Command line
|
### Command line
|
||||||
|
@ -73,8 +73,8 @@ on in the tutorial. Therefore, we'll require you to:
|
||||||
- [Create a GitHub account](https://github.com/join)
|
- [Create a GitHub account](https://github.com/join)
|
||||||
- [Install Git](https://github.com/git-guides/install-git)
|
- [Install Git](https://github.com/git-guides/install-git)
|
||||||
|
|
||||||
If you're unfamiliar with how Git works, we recommend reading GitHub's [Git guides]. You can also
|
If you're unfamiliar with how Git works, we recommend reading GitHub's [Git guides][]. You can also
|
||||||
use the [GitHub Desktop] app if you prefer using a visual interface over the command line.
|
use the [GitHub Desktop][] app if you prefer using a visual interface over the command line.
|
||||||
|
|
||||||
We recommend that you create a local Git repository and publish it to GitHub before starting
|
We recommend that you create a local Git repository and publish it to GitHub before starting
|
||||||
the tutorial, and commit your code after every step.
|
the tutorial, and commit your code after every step.
|
||||||
|
@ -96,8 +96,8 @@ use the latest long-term support (LTS) version.
|
||||||
|
|
||||||
Please install Node.js using pre-built installers for your platform.
|
Please install Node.js using pre-built installers for your platform.
|
||||||
You may encounter incompatibility issues with different development tools otherwise.
|
You may encounter incompatibility issues with different development tools otherwise.
|
||||||
If you are using macOS, we recommend using a package manager like [Homebrew] or
|
If you are using macOS, we recommend using a package manager like [Homebrew][] or
|
||||||
[nvm] to avoid any directory permission issues.
|
[nvm][] to avoid any directory permission issues.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -120,8 +120,8 @@ comes bundled with its own Node.js runtime. This means that your end users do no
|
||||||
need to install Node.js themselves as a prerequisite to running your app.
|
need to install Node.js themselves as a prerequisite to running your app.
|
||||||
|
|
||||||
To check which version of Node.js is running in your app, you can access the global
|
To check which version of Node.js is running in your app, you can access the global
|
||||||
[`process.versions`] variable in the main process or preload script. You can also reference
|
[`process.versions`][] variable in the main process or preload script. You can also reference
|
||||||
the list of versions in the [electron/releases] repository.
|
the list of versions in the [electron/releases][] repository.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ console.log(`Hello from Electron 👋`)
|
||||||
```
|
```
|
||||||
|
|
||||||
Because Electron's main process is a Node.js runtime, you can execute arbitrary Node.js code
|
Because Electron's main process is a Node.js runtime, you can execute arbitrary Node.js code
|
||||||
with the `electron` command (you can even use it as a [REPL]). To execute this script,
|
with the `electron` command (you can even use it as a [REPL][]). To execute this script,
|
||||||
add `electron .` to the `start` command in the [`scripts`][package-scripts]
|
add `electron .` to the `start` command in the [`scripts`][package-scripts]
|
||||||
field of your package.json. This command will tell the Electron executable to look for the main
|
field of your package.json. This command will tell the Electron executable to look for the main
|
||||||
script in the current directory and run it in dev mode.
|
script in the current directory and run it in dev mode.
|
||||||
|
@ -258,7 +258,7 @@ app.whenReady().then(() => {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
Many of Electron's core modules are Node.js [event emitters] that adhere to Node's asynchronous
|
Many of Electron's core modules are Node.js [event emitters][] that adhere to Node's asynchronous
|
||||||
event-driven architecture. The app module is one of these emitters.
|
event-driven architecture. The app module is one of these emitters.
|
||||||
|
|
||||||
In Electron, BrowserWindows can only be created after the app module's [`ready`][app-ready] event
|
In Electron, BrowserWindows can only be created after the app module's [`ready`][app-ready] event
|
||||||
|
@ -288,7 +288,7 @@ open a window that displays your web page!
|
||||||
Each web page your app displays in a window will run in a separate process called a
|
Each web page your app displays in a window will run in a separate process called a
|
||||||
**renderer** process (or simply _renderer_ for short). Renderer processes have access
|
**renderer** process (or simply _renderer_ for short). Renderer processes have access
|
||||||
to the same JavaScript APIs and tooling you use for typical front-end web
|
to the same JavaScript APIs and tooling you use for typical front-end web
|
||||||
development, such as using [webpack] to bundle and minify your code or [React][react]
|
development, such as using [webpack][] to bundle and minify your code or [React][react]
|
||||||
to build your user interfaces.
|
to build your user interfaces.
|
||||||
|
|
||||||
## Managing your app's window lifecycle
|
## Managing your app's window lifecycle
|
||||||
|
@ -403,7 +403,7 @@ What we have done in the `launch.json` file is to create 3 configurations:
|
||||||
that creates the process, we have to "attach" to it (`"request": "attach"`) instead of
|
that creates the process, we have to "attach" to it (`"request": "attach"`) instead of
|
||||||
creating a new one.
|
creating a new one.
|
||||||
The renderer process is a web one, so the debugger we have to use is `chrome`.
|
The renderer process is a web one, so the debugger we have to use is `chrome`.
|
||||||
- `Main + renderer` is a [compound task] that executes the previous ones simultaneously.
|
- `Main + renderer` is a [compound task][] that executes the previous ones simultaneously.
|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ in development mode.
|
||||||
|
|
||||||
If you want to dig deeper in the debugging area, the following guides provide more information:
|
If you want to dig deeper in the debugging area, the following guides provide more information:
|
||||||
|
|
||||||
- [Application Debugging]
|
- [Application Debugging][]
|
||||||
- [DevTools Extensions][devtools extension]
|
- [DevTools Extensions][devtools extension]
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
|
@ -58,7 +58,7 @@ For more information, check out the [Process Sandboxing](./sandbox.md) guide.
|
||||||
|
|
||||||
Preload scripts are injected before a web page loads in the renderer,
|
Preload scripts are injected before a web page loads in the renderer,
|
||||||
similar to a Chrome extension's [content scripts][content-script]. To add features to your renderer
|
similar to a Chrome extension's [content scripts][content-script]. To add features to your renderer
|
||||||
that require privileged access, you can define [global] objects through the
|
that require privileged access, you can define [global][] objects through the
|
||||||
[contextBridge][contextbridge] API.
|
[contextBridge][contextbridge] API.
|
||||||
|
|
||||||
To demonstrate this concept, you will create a preload script that exposes your app's
|
To demonstrate this concept, you will create a preload script that exposes your app's
|
||||||
|
@ -115,7 +115,7 @@ There are two Node.js concepts that are used here:
|
||||||
|
|
||||||
At this point, the renderer has access to the `versions` global, so let's display that
|
At this point, the renderer has access to the `versions` global, so let's display that
|
||||||
information in the window. This variable can be accessed via `window.versions` or simply
|
information in the window. This variable can be accessed via `window.versions` or simply
|
||||||
`versions`. Create a `renderer.js` script that uses the [`document.getElementById`]
|
`versions`. Create a `renderer.js` script that uses the [`document.getElementById`][]
|
||||||
DOM API to replace the displayed text for the HTML element with `info` as its `id` property.
|
DOM API to replace the displayed text for the HTML element with `info` as its `id` property.
|
||||||
|
|
||||||
```js title="renderer.js"
|
```js title="renderer.js"
|
||||||
|
|
|
@ -49,7 +49,7 @@ and deeper operating system integrations. To get started, check out the
|
||||||
|
|
||||||
:::note Let us know if something is missing!
|
:::note Let us know if something is missing!
|
||||||
|
|
||||||
If you can't find what you are looking for, please let us know on [GitHub] or in
|
If you can't find what you are looking for, please let us know on [GitHub][] or in
|
||||||
our [Discord server][discord]!
|
our [Discord server][discord]!
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
|
@ -24,7 +24,7 @@ This is **part 5** of the Electron tutorial.
|
||||||
## Learning goals
|
## Learning goals
|
||||||
|
|
||||||
In this part of the tutorial, we'll be going over the basics of packaging and distributing
|
In this part of the tutorial, we'll be going over the basics of packaging and distributing
|
||||||
your app with [Electron Forge].
|
your app with [Electron Forge][].
|
||||||
|
|
||||||
## Using Electron Forge
|
## Using Electron Forge
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ as a **distributable**). Distributables can be either installers (e.g. MSI on Wi
|
||||||
portable executable files (e.g. `.app` on macOS).
|
portable executable files (e.g. `.app` on macOS).
|
||||||
|
|
||||||
Electron Forge is an all-in-one tool that handles the packaging and distribution of Electron
|
Electron Forge is an all-in-one tool that handles the packaging and distribution of Electron
|
||||||
apps. Under the hood, it combines a lot of existing Electron tools (e.g. [`electron-packager`],
|
apps. Under the hood, it combines a lot of existing Electron tools (e.g. [`electron-packager`][],
|
||||||
[`@electron/osx-sign`], [`electron-winstaller`], etc.) into a single interface so you do not
|
[`@electron/osx-sign`][], [`electron-winstaller`][], etc.) into a single interface so you do not
|
||||||
have to worry about wiring them all together.
|
have to worry about wiring them all together.
|
||||||
|
|
||||||
### Importing your project into Forge
|
### Importing your project into Forge
|
||||||
|
@ -65,7 +65,7 @@ to your `package.json` file.
|
||||||
:::info CLI documentation
|
:::info CLI documentation
|
||||||
|
|
||||||
For more information on `make` and other Forge APIs, check out
|
For more information on `make` and other Forge APIs, check out
|
||||||
the [Electron Forge CLI documentation].
|
the [Electron Forge CLI documentation][].
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -106,21 +106,21 @@ created your first bundled Electron application.
|
||||||
:::tip Distributable formats
|
:::tip Distributable formats
|
||||||
|
|
||||||
Electron Forge can be configured to create distributables in different OS-specific formats
|
Electron Forge can be configured to create distributables in different OS-specific formats
|
||||||
(e.g. DMG, deb, MSI, etc.). See Forge's [Makers] documentation for all configuration options.
|
(e.g. DMG, deb, MSI, etc.). See Forge's [Makers][] documentation for all configuration options.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
:::tip Creating and adding application icons
|
:::tip Creating and adding application icons
|
||||||
|
|
||||||
Setting custom application icons requires a few additions to your config.
|
Setting custom application icons requires a few additions to your config.
|
||||||
Check out [Forge's icon tutorial] for more information.
|
Check out [Forge's icon tutorial][] for more information.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
:::info Packaging without Electron Forge
|
:::info Packaging without Electron Forge
|
||||||
|
|
||||||
If you want to manually package your code, or if you're just interested understanding the
|
If you want to manually package your code, or if you're just interested understanding the
|
||||||
mechanics behind packaging an Electron app, check out the full [Application Packaging]
|
mechanics behind packaging an Electron app, check out the full [Application Packaging][]
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
|
@ -31,7 +31,7 @@ at [https://update.electronjs.org](https://update.electronjs.org). Its requireme
|
||||||
|
|
||||||
- Your app runs on macOS or Windows
|
- Your app runs on macOS or Windows
|
||||||
- Your app has a public GitHub repository
|
- Your app has a public GitHub repository
|
||||||
- Builds are published to [GitHub releases]
|
- Builds are published to [GitHub releases][]
|
||||||
- Builds are [code signed][code-signed]
|
- Builds are [code signed][code-signed]
|
||||||
|
|
||||||
At this point, we'll assume that you have already pushed all your
|
At this point, we'll assume that you have already pushed all your
|
||||||
|
@ -47,7 +47,7 @@ you need to keep your code repository private, please refer to our
|
||||||
|
|
||||||
## Publishing a GitHub release
|
## Publishing a GitHub release
|
||||||
|
|
||||||
Electron Forge has [Publisher] plugins that can automate the distribution
|
Electron Forge has [Publisher][] plugins that can automate the distribution
|
||||||
of your packaged application to various sources. In this tutorial, we will
|
of your packaged application to various sources. In this tutorial, we will
|
||||||
be using the GitHub Publisher, which will allow us to publish
|
be using the GitHub Publisher, which will allow us to publish
|
||||||
our code to GitHub releases.
|
our code to GitHub releases.
|
||||||
|
@ -65,7 +65,7 @@ with the `public_repo` scope, which gives write access to your public repositori
|
||||||
|
|
||||||
#### Installing the module
|
#### Installing the module
|
||||||
|
|
||||||
Forge's [GitHub Publisher] is a plugin that
|
Forge's [GitHub Publisher][] is a plugin that
|
||||||
needs to be installed in your project's `devDependencies`:
|
needs to be installed in your project's `devDependencies`:
|
||||||
|
|
||||||
```sh npm2yarn
|
```sh npm2yarn
|
||||||
|
@ -76,7 +76,7 @@ npm install --save-dev @electron-forge/publisher-github
|
||||||
|
|
||||||
Once you have it installed, you need to set it up in your Forge
|
Once you have it installed, you need to set it up in your Forge
|
||||||
configuration. A full list of options is documented in the Forge's
|
configuration. A full list of options is documented in the Forge's
|
||||||
[`PublisherGitHubConfig`] API docs.
|
[`PublisherGitHubConfig`][] API docs.
|
||||||
|
|
||||||
```js title='forge.config.js'
|
```js title='forge.config.js'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -114,7 +114,7 @@ variable.
|
||||||
|
|
||||||
### Running the publish command
|
### Running the publish command
|
||||||
|
|
||||||
Add Forge's [publish command] to your npm scripts.
|
Add Forge's [publish command][] to your npm scripts.
|
||||||
|
|
||||||
```json {6} title='package.json'
|
```json {6} title='package.json'
|
||||||
//...
|
//...
|
||||||
|
@ -155,8 +155,8 @@ Publishing locally can be painful, especially because you can only create distri
|
||||||
for your host operating system (i.e. you can't publish a Window `.exe` file from macOS).
|
for your host operating system (i.e. you can't publish a Window `.exe` file from macOS).
|
||||||
|
|
||||||
A solution for this would be to publish your app via automation workflows
|
A solution for this would be to publish your app via automation workflows
|
||||||
such as [GitHub Actions], which can run tasks in the
|
such as [GitHub Actions][], which can run tasks in the
|
||||||
cloud on Ubuntu, macOS, and Windows. This is the exact approach taken by [Electron Fiddle].
|
cloud on Ubuntu, macOS, and Windows. This is the exact approach taken by [Electron Fiddle][].
|
||||||
You can refer to Fiddle's [Build and Release pipeline][fiddle-build]
|
You can refer to Fiddle's [Build and Release pipeline][fiddle-build]
|
||||||
and [Forge configuration][fiddle-forge-config]
|
and [Forge configuration][fiddle-forge-config]
|
||||||
for more details.
|
for more details.
|
||||||
|
@ -165,7 +165,7 @@ for more details.
|
||||||
|
|
||||||
Now that we have a functional release system via GitHub releases, we now need to tell our
|
Now that we have a functional release system via GitHub releases, we now need to tell our
|
||||||
Electron app to download an update whenever a new release is out. Electron apps do this
|
Electron app to download an update whenever a new release is out. Electron apps do this
|
||||||
via the [autoUpdater] module, which reads from an update server feed to check if a new version
|
via the [autoUpdater][] module, which reads from an update server feed to check if a new version
|
||||||
is available for download.
|
is available for download.
|
||||||
|
|
||||||
The update.electronjs.org service provides an updater-compatible feed. For example, Electron
|
The update.electronjs.org service provides an updater-compatible feed. For example, Electron
|
||||||
|
@ -175,7 +175,7 @@ to see if a newer GitHub release is available.
|
||||||
After your release is published to GitHub, the update.electronjs.org service should work
|
After your release is published to GitHub, the update.electronjs.org service should work
|
||||||
for your application. The only step left is to configure the feed with the autoUpdater module.
|
for your application. The only step left is to configure the feed with the autoUpdater module.
|
||||||
|
|
||||||
To make this process easier, the Electron team maintains the [`update-electron-app`] module,
|
To make this process easier, the Electron team maintains the [`update-electron-app`][] module,
|
||||||
which sets up the autoUpdater boilerplate for update.electronjs.org in one function
|
which sets up the autoUpdater boilerplate for update.electronjs.org in one function
|
||||||
call — no configuration required. This module will search for the update.electronjs.org
|
call — no configuration required. This module will search for the update.electronjs.org
|
||||||
feed that matches your project's package.json `"repository"` field.
|
feed that matches your project's package.json `"repository"` field.
|
||||||
|
@ -214,7 +214,7 @@ own update server and configure the autoUpdater module yourself.
|
||||||
|
|
||||||
From here, you have officially completed our tutorial to Electron. Feel free to explore the
|
From here, you have officially completed our tutorial to Electron. Feel free to explore the
|
||||||
rest of our docs and happy developing! If you have questions, please stop by our community
|
rest of our docs and happy developing! If you have questions, please stop by our community
|
||||||
[Discord server].
|
[Discord server][].
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ Electron's [autoUpdater](../api/auto-updater.md) module.
|
||||||
|
|
||||||
## Using update.electronjs.org
|
## Using update.electronjs.org
|
||||||
|
|
||||||
The Electron team maintains [update.electronjs.org], a free and open-source
|
The Electron team maintains [update.electronjs.org][], a free and open-source
|
||||||
webservice that Electron apps can use to self-update. The service is designed
|
webservice that Electron apps can use to self-update. The service is designed
|
||||||
for Electron apps that meet the following criteria:
|
for Electron apps that meet the following criteria:
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ for Electron apps that meet the following criteria:
|
||||||
- Builds are published to [GitHub Releases][gh-releases]
|
- Builds are published to [GitHub Releases][gh-releases]
|
||||||
- Builds are [code-signed](./code-signing.md)
|
- Builds are [code-signed](./code-signing.md)
|
||||||
|
|
||||||
The easiest way to use this service is by installing [update-electron-app],
|
The easiest way to use this service is by installing [update-electron-app][],
|
||||||
a Node.js module preconfigured for use with update.electronjs.org.
|
a Node.js module preconfigured for use with update.electronjs.org.
|
||||||
|
|
||||||
Install the module using your Node.js package manager of choice:
|
Install the module using your Node.js package manager of choice:
|
||||||
|
|
|
@ -7,7 +7,7 @@ macOS, Windows, and Linux.
|
||||||
|
|
||||||
## Create frameless windows
|
## Create frameless windows
|
||||||
|
|
||||||
A frameless window is a window that has no [chrome]. Not to be confused with the Google
|
A frameless window is a window that has no [chrome][]. Not to be confused with the Google
|
||||||
Chrome browser, window _chrome_ refers to the parts of the window (e.g. toolbars, controls)
|
Chrome browser, window _chrome_ refers to the parts of the window (e.g. toolbars, controls)
|
||||||
that are not a part of the web page.
|
that are not a part of the web page.
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ win.setWindowButtonVisibility(false)
|
||||||
|
|
||||||
## Window Controls Overlay _macOS_ _Windows_
|
## Window Controls Overlay _macOS_ _Windows_
|
||||||
|
|
||||||
The [Window Controls Overlay API] is a web standard that gives web apps the ability to
|
The [Window Controls Overlay API][] is a web standard that gives web apps the ability to
|
||||||
customize their title bar region when installed on desktop. Electron exposes this API
|
customize their title bar region when installed on desktop. Electron exposes this API
|
||||||
through the `BrowserWindow` constructor option `titleBarOverlay`.
|
through the `BrowserWindow` constructor option `titleBarOverlay`.
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ const win = new BrowserWindow({ transparent: true })
|
||||||
[#1335](https://github.com/electron/electron/issues/1335) for details.
|
[#1335](https://github.com/electron/electron/issues/1335) for details.
|
||||||
* Transparent windows are not resizable. Setting `resizable` to `true` may make
|
* Transparent windows are not resizable. Setting `resizable` to `true` may make
|
||||||
a transparent window stop working on some platforms.
|
a transparent window stop working on some platforms.
|
||||||
* The CSS [`blur()`] filter only applies to the window's web contents, so there is no way to apply
|
* The CSS [`blur()`][] filter only applies to the window's web contents, so there is no way to apply
|
||||||
blur effect to the content below the window (i.e. other applications open on
|
blur effect to the content below the window (i.e. other applications open on
|
||||||
the user's system).
|
the user's system).
|
||||||
* The window will not be transparent when DevTools is opened.
|
* The window will not be transparent when DevTools is opened.
|
||||||
|
|
|
@ -54,8 +54,7 @@
|
||||||
"klaw": "^3.0.0",
|
"klaw": "^3.0.0",
|
||||||
"lint": "^1.1.2",
|
"lint": "^1.1.2",
|
||||||
"lint-staged": "^10.2.11",
|
"lint-staged": "^10.2.11",
|
||||||
"markdownlint": "^0.26.2",
|
"markdownlint-cli": "^0.33.0",
|
||||||
"markdownlint-cli": "^0.32.2",
|
|
||||||
"minimist": "^1.2.6",
|
"minimist": "^1.2.6",
|
||||||
"null-loader": "^4.0.0",
|
"null-loader": "^4.0.0",
|
||||||
"pre-flight": "^1.1.0",
|
"pre-flight": "^1.1.0",
|
||||||
|
@ -90,7 +89,7 @@
|
||||||
"lint:gn": "node ./script/lint.js --gn",
|
"lint:gn": "node ./script/lint.js --gn",
|
||||||
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links && npm run lint:markdownlint",
|
"lint:docs": "remark docs -qf && npm run lint:js-in-markdown && npm run create-typescript-definitions && npm run lint:docs-relative-links && npm run lint:markdownlint",
|
||||||
"lint:docs-relative-links": "python3 ./script/check-relative-doc-links.py",
|
"lint:docs-relative-links": "python3 ./script/check-relative-doc-links.py",
|
||||||
"lint:markdownlint": "markdownlint \"*.md\" \"docs/**/*.md\"",
|
"lint:markdownlint": "markdownlint -r ./script/markdownlint-emd001.js \"*.md\" \"docs/**/*.md\"",
|
||||||
"lint:js-in-markdown": "standard-markdown docs",
|
"lint:js-in-markdown": "standard-markdown docs",
|
||||||
"create-api-json": "node script/create-api-json.js",
|
"create-api-json": "node script/create-api-json.js",
|
||||||
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --api=electron-api.json && node spec/ts-smoke/runner.js",
|
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --api=electron-api.json && node spec/ts-smoke/runner.js",
|
||||||
|
|
21
script/markdownlint-emd001.js
Normal file
21
script/markdownlint-emd001.js
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
const { addError, getLineMetadata, getReferenceLinkImageData } = require('markdownlint/helpers');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
names: ['EMD001', 'no-shortcut-reference-links'],
|
||||||
|
description:
|
||||||
|
'Disallow shortcut reference links (those with no link label)',
|
||||||
|
tags: ['images', 'links'],
|
||||||
|
function: function EMD001 (params, onError) {
|
||||||
|
const lineMetadata = getLineMetadata(params);
|
||||||
|
const { shortcuts } = getReferenceLinkImageData(lineMetadata);
|
||||||
|
for (const [shortcut, occurrences] of shortcuts) {
|
||||||
|
for (const [lineNumber] of occurrences) {
|
||||||
|
addError(
|
||||||
|
onError,
|
||||||
|
lineNumber + 1, // human-friendly line numbers (1-based)
|
||||||
|
`Disallowed shortcut reference link: "${shortcut}"`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
59
yarn.lock
59
yarn.lock
|
@ -1902,7 +1902,7 @@ commander@^7.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
|
||||||
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
|
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
|
||||||
|
|
||||||
commander@~9.4.0:
|
commander@~9.4.1:
|
||||||
version "9.4.1"
|
version "9.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd"
|
||||||
integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==
|
integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==
|
||||||
|
@ -3297,10 +3297,10 @@ ignore@^5.0.0, ignore@^5.1.1, ignore@^5.1.4:
|
||||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
|
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
|
||||||
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
|
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
|
||||||
|
|
||||||
ignore@~5.2.0:
|
ignore@~5.2.4:
|
||||||
version "5.2.1"
|
version "5.2.4"
|
||||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.1.tgz#c2b1f76cb999ede1502f3a226a9310fdfe88d46c"
|
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324"
|
||||||
integrity sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==
|
integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==
|
||||||
|
|
||||||
import-fresh@^3.0.0:
|
import-fresh@^3.0.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
|
@ -3679,10 +3679,10 @@ json5@^2.0.0, json5@^2.1.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
minimist "^1.2.5"
|
minimist "^1.2.5"
|
||||||
|
|
||||||
jsonc-parser@~3.1.0:
|
jsonc-parser@~3.2.0:
|
||||||
version "3.1.0"
|
version "3.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.1.0.tgz#73b8f0e5c940b83d03476bc2e51a20ef0932615d"
|
resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
|
||||||
integrity sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg==
|
integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==
|
||||||
|
|
||||||
jsonfile@^4.0.0:
|
jsonfile@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
|
@ -4069,31 +4069,25 @@ markdown-it@^10.0.0:
|
||||||
mdurl "^1.0.1"
|
mdurl "^1.0.1"
|
||||||
uc.micro "^1.0.5"
|
uc.micro "^1.0.5"
|
||||||
|
|
||||||
markdownlint-cli@^0.32.2:
|
markdownlint-cli@^0.33.0:
|
||||||
version "0.32.2"
|
version "0.33.0"
|
||||||
resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.32.2.tgz#b7b5c5808039aef4022aef603efaa607caf8e0de"
|
resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.33.0.tgz#703af1234c32c309ab52fcd0e8bc797a34e2b096"
|
||||||
integrity sha512-xmJT1rGueUgT4yGNwk6D0oqQr90UJ7nMyakXtqjgswAkEhYYqjHew9RY8wDbOmh2R270IWjuKSeZzHDEGPAUkQ==
|
integrity sha512-zMK1oHpjYkhjO+94+ngARiBBrRDEUMzooDHBAHtmEIJ9oYddd9l3chCReY2mPlecwH7gflQp1ApilTo+o0zopQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
commander "~9.4.0"
|
commander "~9.4.1"
|
||||||
get-stdin "~9.0.0"
|
get-stdin "~9.0.0"
|
||||||
glob "~8.0.3"
|
glob "~8.0.3"
|
||||||
ignore "~5.2.0"
|
ignore "~5.2.4"
|
||||||
js-yaml "^4.1.0"
|
js-yaml "^4.1.0"
|
||||||
jsonc-parser "~3.1.0"
|
jsonc-parser "~3.2.0"
|
||||||
markdownlint "~0.26.2"
|
markdownlint "~0.27.0"
|
||||||
markdownlint-rule-helpers "~0.17.2"
|
minimatch "~5.1.2"
|
||||||
minimatch "~5.1.0"
|
|
||||||
run-con "~1.2.11"
|
run-con "~1.2.11"
|
||||||
|
|
||||||
markdownlint-rule-helpers@~0.17.2:
|
markdownlint@~0.27.0:
|
||||||
version "0.17.2"
|
version "0.27.0"
|
||||||
resolved "https://registry.yarnpkg.com/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.17.2.tgz#64d6e8c66e497e631b0e40cf1cef7ca622a0b654"
|
resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.27.0.tgz#9dabf7710a4999e2835e3c68317f1acd0bc89049"
|
||||||
integrity sha512-XaeoW2NYSlWxMCZM2B3H7YTG6nlaLfkEZWMBhr4hSPlq9MuY2sy83+Xr89jXOqZMZYjvi5nBCGoFh7hHoPKZmA==
|
integrity sha512-HtfVr/hzJJmE0C198F99JLaeada+646B5SaG2pVoEakLFI6iRGsvMqrnnrflq8hm1zQgwskEgqSnhDW11JBp0w==
|
||||||
|
|
||||||
markdownlint@^0.26.2, markdownlint@~0.26.2:
|
|
||||||
version "0.26.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.26.2.tgz#11d3d03e7f0dd3c2e239753ee8fd064a861d9237"
|
|
||||||
integrity sha512-2Am42YX2Ex5SQhRq35HxYWDfz1NLEOZWWN25nqd2h3AHRKsGRE+Qg1gt1++exW792eXTrR4jCNHfShfWk9Nz8w==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
markdown-it "13.0.1"
|
markdown-it "13.0.1"
|
||||||
|
|
||||||
|
@ -4434,13 +4428,20 @@ minimatch@^3.0.2, minimatch@^3.0.4, minimatch@~3.0.4:
|
||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion "^1.1.7"
|
brace-expansion "^1.1.7"
|
||||||
|
|
||||||
minimatch@^5.0.1, minimatch@~5.1.0:
|
minimatch@^5.0.1:
|
||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.1.tgz#6c9dffcf9927ff2a31e74b5af11adf8b9604b022"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.1.tgz#6c9dffcf9927ff2a31e74b5af11adf8b9604b022"
|
||||||
integrity sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==
|
integrity sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g==
|
||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion "^2.0.1"
|
brace-expansion "^2.0.1"
|
||||||
|
|
||||||
|
minimatch@~5.1.2:
|
||||||
|
version "5.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.2.tgz#0939d7d6f0898acbd1508abe534d1929368a8fff"
|
||||||
|
integrity sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==
|
||||||
|
dependencies:
|
||||||
|
brace-expansion "^2.0.1"
|
||||||
|
|
||||||
minimist@^1.0.0, minimist@^1.2.5, minimist@^1.2.6, minimist@~1.2.0:
|
minimist@^1.0.0, minimist@^1.2.5, minimist@^1.2.6, minimist@~1.2.0:
|
||||||
version "1.2.6"
|
version "1.2.6"
|
||||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
|
||||||
|
|
Loading…
Reference in a new issue