chore: cleanup whitespace in docs (#26356)

This commit is contained in:
David Sanders 2020-11-05 14:12:43 -08:00 committed by GitHub
parent 3814a56d48
commit 43dbd1bdf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 129 additions and 72 deletions

View file

@ -859,9 +859,10 @@ This method returns the application name of the default handler for the protocol
minimum (e.g. `https://`).
Returns `Promise<Object>` - Resolve with an object containing the following:
* `icon` NativeImage - the display icon of the app handling the protocol.
* `path` String - installation path of the app handling the protocol.
* `name` String - display name of the app handling the protocol.
* `icon` NativeImage - the display icon of the app handling the protocol.
* `path` String - installation path of the app handling the protocol.
* `name` String - display name of the app handling the protocol.
This method returns a promise that contains the application name, icon and path of the default handler for the protocol
(aka URI scheme) of a URL.
@ -1091,6 +1092,7 @@ Changes the [Application User Model ID][app-user-model-id] to `id`.
Sets the activation policy for a given app.
Activation policy types:
* 'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.
* 'accessory' - The application doesnt appear in the Dock and doesnt have a menu bar, but it may be activated programmatically or by clicking on one of its windows.
* 'prohibited' - The application doesnt appear in the Dock and may not create windows or be activated.
@ -1142,6 +1144,7 @@ For `infoType` equal to `complete`:
For `infoType` equal to `basic`:
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:
```js
{
auxAttributes:

View file

@ -468,6 +468,7 @@ window.onbeforeunload = (e) => {
e.returnValue = false // equivalent to `return false` but not recommended
}
```
_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._
#### Event: 'closed'
@ -859,7 +860,7 @@ A `Boolean` property that determines whether the menu bar should be visible.
**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.
#### `win.kiosk`
#### `win.kiosk`
A `Boolean` property that determines whether the window is in kiosk mode.
@ -1049,7 +1050,7 @@ Returns `Boolean` - Whether the window is in normal state (not maximized, not mi
* `aspectRatio` Float - The aspect ratio to maintain for some portion of the
content view.
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
maintaining the aspect ratio.
This will make a window maintain an aspect ratio. The extra size allows a

View file

@ -98,6 +98,7 @@ request.on('login', (authInfo, callback) => {
callback('username', 'password')
})
```
Providing empty credentials will cancel the request and report an authentication
error on the response object:
@ -139,7 +140,6 @@ Emitted as the last event in the HTTP request-response transaction. The `close`
event indicates that no more events will be emitted on either the `request` or
`response` objects.
#### Event: 'redirect'
Returns:

View file

@ -64,6 +64,7 @@ Forces the maximum disk space to be used by the disk cache, in bytes.
### --enable-api-filtering-logging
Enables caller stack logging for the following APIs (filtering events):
- `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
- `remote.require()` / `remote-require`
- `remote.getGlobal()` / `remote-get-builtin`
@ -227,6 +228,7 @@ See the [Debugging the Main Process][debugging-main-process] guide for more deta
Aliased to `--debug[=[host:]port`.
### --inspect-publish-uid=stderr,http
Specify ways of the inspector web socket url exposure.
By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.

View file

@ -108,5 +108,4 @@ has been included below for completeness:
| [Cloneable Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) | Simple | ✅ | ✅ | See the linked document on cloneable types |
| `Symbol` | N/A | ❌ | ❌ | Symbols cannot be copied across contexts so they are dropped |
If the type you care about is not in the above table, it is probably not supported.

View file

@ -205,9 +205,10 @@ The `filters` specifies an array of file types that can be displayed, see
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.
Returns `Promise<Object>` - Resolve with an object containing the following:
* `canceled` Boolean - whether or not the dialog was canceled.
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
* `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
* `canceled` Boolean - whether or not the dialog was canceled.
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
* `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
@ -302,8 +303,9 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
via `Alt-W` on Windows and Linux.
Returns `Promise<Object>` - resolves with a promise containing the following properties:
* `response` Number - The index of the clicked button.
* `checkboxChecked` Boolean - The checked state of the checkbox if
* `response` Number - The index of the clicked button.
* `checkboxChecked` Boolean - The checked state of the checkbox if
`checkboxLabel` was set. Otherwise `false`.
Shows a message box.

View file

@ -105,6 +105,7 @@ Don't use the global menu bar on Linux.
Set the trash implementation on Linux. Default is `gio`.
Options:
* `gvfs-trash`
* `trash-cli`
* `kioclient5`
@ -115,7 +116,6 @@ Options:
The following environment variables are intended primarily for development and
debugging purposes.
### `ELECTRON_ENABLE_LOGGING`
Prints Chrome's internal logging to the console.

View file

@ -12,7 +12,6 @@ options on the [`BrowserWindow`](browser-window.md) class.
To create a frameless window, you need to set `frame` to `false` in
[BrowserWindow](browser-window.md)'s `options`:
```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600, frame: false })

View file

@ -93,6 +93,7 @@ The main process should listen for `channel` with
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).
For example:
```javascript
// Renderer process
ipcRenderer.invoke('some-name', someArgument).then((result) => {
@ -149,6 +150,7 @@ The transferred `MessagePort` objects will be available in the main process as
property of the emitted event.
For example:
```js
// Renderer process
const { port1, port2 } = new MessageChannel()

View file

@ -138,6 +138,7 @@ A `String` indicating the item's visible label.
A `Function` that is fired when the MenuItem receives a click event.
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `focusedWindow` [BrowserWindow](browser-window.md)
* `focusedWebContents` [WebContents](web-contents.md)

View file

@ -12,6 +12,7 @@ channel messaging.
Process: [Main](../glossary.md#main-process)
Example:
```js
// Main process
const { port1, port2 } = new MessageChannelMain()

View file

@ -34,6 +34,7 @@ Setting this property to `system` will remove the override and
everything will be reset to the OS default. By default `themeSource` is `system`.
Settings this property to `dark` will have the following effects:
* `nativeTheme.shouldUseDarkColors` will be `true` when accessed
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.
* Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.
@ -41,6 +42,7 @@ Settings this property to `dark` will have the following effects:
* The `updated` event will be emitted
Settings this property to `light` will have the following effects:
* `nativeTheme.shouldUseDarkColors` will be `false` when accessed
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.
* Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.
@ -49,6 +51,7 @@ Settings this property to `light` will have the following effects:
The usage of this property should align with a classic "dark mode" state machine in your application
where the user has three options.
* `Follow OS` --> `themeSource = 'system'`
* `Dark Mode` --> `themeSource = 'dark'`
* `Light Mode` --> `themeSource = 'light'`

View file

@ -11,6 +11,7 @@ It adds the following events, properties, and methods:
## Sandbox
In sandboxed renderers the `process` object contains only a subset of the APIs:
- `crash()`
- `hang()`
- `getCreationTime()`
@ -104,6 +105,7 @@ A `Boolean` that controls whether or not deprecations printed to `stderr` includ
This property is instead of the `--trace-deprecation` command line flag.
### `process.traceProcessWarnings`
A `Boolean` that controls whether or not process warnings printed to `stderr` include
their stack trace. Setting this to `true` will print stack traces for process warnings
(including deprecations). This property is instead of the `--trace-warnings` command

View file

@ -35,6 +35,7 @@ win.loadURL('https://github.com')
you can use [webContents.executeJavaScript](web-contents.md#contentsexecutejavascriptcode-usergesture).
**Note:** The remote module can be disabled for security reasons in the following contexts:
- [`BrowserWindow`](browser-window.md) - by setting the `enableRemoteModule` option to `false`.
- [`<webview>`](webview-tag.md) - by setting the `enableremotemodule` attribute to `false`.
@ -207,7 +208,6 @@ module.exports = 'bar'
const foo = require('electron').remote.require('./foo') // bar
```
### `remote.process` _Readonly_
A `NodeJS.Process` object. The `process` object in the main process. This is the same as

View file

@ -100,10 +100,11 @@ Returns:
Emitted after an extension is loaded. This occurs whenever an extension is
added to the "enabled" set of extensions. This includes:
- Extensions being loaded from `Session.loadExtension`.
- Extensions being reloaded:
* from a crash.
* if the extension requested it ([`chrome.runtime.reload()`](https://developer.chrome.com/extensions/runtime#method-reload)).
* from a crash.
* if the extension requested it ([`chrome.runtime.reload()`](https://developer.chrome.com/extensions/runtime#method-reload)).
#### Event: 'extension-unloaded'
@ -354,7 +355,7 @@ The `proxyBypassRules` is a comma separated list of rules described below:
"foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
"https://x.*.y.com:99"
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
Match a particular domain suffix.

View file

@ -1,4 +1,3 @@
# NewWindowWebContentsEvent Object extends `Event`
* `newGuest` BrowserWindow (optional)

View file

@ -52,12 +52,12 @@ app.whenReady().then(() => {
appIcon.setContextMenu(contextMenu)
})
```
* On Windows it is recommended to use `ICO` icons to get best visual effects.
If you want to keep exact same behaviors on all platforms, you should not
rely on the `click` event and always attach a context menu to the tray icon.
### `new Tray(image, [guid])`
* `image` ([NativeImage](native-image.md) | String)

View file

@ -438,6 +438,7 @@ Emitted when the window leaves a full-screen state triggered by HTML API.
#### Event: 'zoom-changed'
Returns:
* `event` Event
* `zoomDirection` String - Can be `in` or `out`.
@ -1690,6 +1691,7 @@ process by accessing the `ports` property of the emitted event. When they
arrive in the renderer, they will be native DOM `MessagePort` objects.
For example:
```js
// Main process
const { port1, port2 } = new MessageChannelMain()

View file

@ -175,6 +175,7 @@ reject and the `result` would be `undefined`. This is because Chromium does not
dispatch errors of isolated worlds to foreign worlds.
### `webFrame.setIsolatedWorldInfo(worldId, info)`
* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
* `info` Object
* `securityOrigin` String (optional) - Security origin for the isolated world.

View file

@ -27,6 +27,7 @@ The `features` string follows the format of standard browser, but each feature
has to be a field of `BrowserWindow`'s options. These are the features you can set via `features` string: `zoomFactor`, `nodeIntegration`, `preload`, `javascript`, `contextIsolation`, `webviewTag`.
For example:
```js
window.open('https://github.com', '_blank', 'nodeIntegration=no')
```