build: move to the new docs parser (#18103)

* build: move to the new docs parser

* chore: remove the bad getTitle param doc

* build: update parser/ts gen deps + fix some docs issues highlighted by GH desktop

* chore: apply suggestions from code review

Co-Authored-By: MarshallOfSound <samuel.r.attard@gmail.com>

* chore: update docs for accidentally removed things

* chore: update docs/api/command-line.md

Co-Authored-By: MarshallOfSound <samuel.r.attard@gmail.com>
This commit is contained in:
Samuel Attard 2019-05-06 08:29:01 -07:00 committed by John Kleinschmidt
parent 9ec59cbc6c
commit a96b6e2c96
28 changed files with 461 additions and 1234 deletions

View file

@ -782,8 +782,8 @@ Returns `Object`:
* `minItems` Integer - The minimum number of items that will be shown in the
Jump List (for a more detailed description of this value see the
[MSDN docs][JumpListBeginListMSDN]).
* `removedItems` [JumpListItem[]](structures/jump-list-item.md) - Array of `JumpListItem` objects that correspond to
items that the user has explicitly removed from custom categories in the
* `removedItems` [JumpListItem[]](structures/jump-list-item.md) - Array of `JumpListItem`
objects that correspond to items that the user has explicitly removed from custom categories in the
Jump List. These items must not be re-added to the Jump List in the **next**
call to `app.setJumpList()`, Windows will not display any custom category
that contains any of the removed items.
@ -1016,7 +1016,7 @@ Returns [`GPUFeatureStatus`](structures/gpu-feature-status.md) - The Graphics Fe
* `infoType` String - Values can be either `basic` for basic info or `complete` for complete info.
Returns `Promise`
Returns `Promise<unknown>`
For `infoType` equal to `complete`:
Promise is fulfilled with `Object` containing all the GPU Information as in [chromium's GPUInfo object](https://chromium.googlesource.com/chromium/src.git/+/69.0.3497.106/gpu/config/gpu_info.cc). This includes the version and driver information that's shown on `chrome://gpu` page.
@ -1159,7 +1159,7 @@ This API must be called after the `ready` event is emitted.
**[Deprecated Soon](modernization/property-updates.md)**
### `app.showAboutPanel` _macOS_ _Linux_
### `app.showAboutPanel()` _macOS_ _Linux_
Show the app's about panel options. These options can be overridden with `app.setAboutPanelOptions(options)`.
@ -1177,11 +1177,11 @@ Show the app's about panel options. These options can be overridden with `app.se
Set the about panel options. This will override the values defined in the app's
`.plist` file on MacOS. See the [Apple docs][about-panel-options] for more details. On Linux, values must be set in order to be shown; there are no defaults.
### `app.isEmojiPanelSupported`
### `app.isEmojiPanelSupported()`
Returns `Boolean` - whether or not the current OS version allows for native emoji pickers.
### `app.showEmojiPanel` _macOS_ _Windows_
### `app.showEmojiPanel()` _macOS_ _Windows_
Show the platform's native emoji picker.
@ -1202,42 +1202,6 @@ stopAccessingSecurityScopedResource()
Start accessing a security scoped resource. With this method Electron applications that are packaged for the Mac App Store may reach outside their sandbox to access files chosen by the user. See [Apple's documentation](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) for a description of how this system works.
### `app.commandLine.appendSwitch(switch[, value])`
* `switch` String - A command-line switch, without the leading `--`
* `value` String (optional) - A value for the given switch
Append a switch (with optional `value`) to Chromium's command line.
**Note:** This will not affect `process.argv`. The intended usage of this function is to
control Chromium's behavior.
### `app.commandLine.appendArgument(value)`
* `value` String - The argument to append to the command line
Append an argument to Chromium's command line. The argument will be quoted
correctly. Switches will precede arguments regardless of appending order.
If you're appending an argument like `--switch=value`, consider using `appendSwitch('switch', 'value')` instead.
**Note:** This will not affect `process.argv`. The intended usage of this function is to
control Chromium's behavior.
### `app.commandLine.hasSwitch(switch)`
* `switch` String - A command-line switch
Returns `Boolean` - Whether the command-line switch is present.
### `app.commandLine.getSwitchValue(switch)`
* `switch` String - A command-line switch
Returns `String` - The command-line switch value.
**Note:** When the switch is not present or has no value, it returns empty string.
### `app.enableSandbox()` _Experimental_
Enables full sandbox mode on the app.
@ -1264,70 +1228,6 @@ method returns false. If we fail to perform the copy, then this method will
throw an error. The message in the error should be informative and tell
you exactly what went wrong
### `app.dock.bounce([type])` _macOS_
* `type` String (optional) - Can be `critical` or `informational`. The default is
`informational`
When `critical` is passed, the dock icon will bounce until either the
application becomes active or the request is canceled.
When `informational` is passed, the dock icon will bounce for one second.
However, the request remains active until either the application becomes active
or the request is canceled.
Returns `Integer` an ID representing the request.
### `app.dock.cancelBounce(id)` _macOS_
* `id` Integer
Cancel the bounce of `id`.
### `app.dock.downloadFinished(filePath)` _macOS_
* `filePath` String
Bounces the Downloads stack if the filePath is inside the Downloads folder.
### `app.dock.setBadge(text)` _macOS_
* `text` String
Sets the string to be displayed in the docks badging area.
### `app.dock.getBadge()` _macOS_
Returns `String` - The badge string of the dock.
### `app.dock.hide()` _macOS_
Hides the dock icon.
### `app.dock.show()` _macOS_
Returns `Promise<void>` - Resolves when the dock icon is shown.
### `app.dock.isVisible()` _macOS_
Returns `Boolean` - Whether the dock icon is visible.
### `app.dock.setMenu(menu)` _macOS_
* `menu` [Menu](menu.md)
Sets the application's [dock menu][dock-menu].
### `app.dock.getMenu()` _macOS_
Returns `Menu | null` - The application's [dock menu][dock-menu].
### `app.dock.setIcon(image)` _macOS_
* `image` ([NativeImage](native-image.md) | String)
Sets the `image` associated with this dock icon.
## Properties
### `app.accessibilitySupportEnabled` _macOS_ _Windows_
@ -1342,7 +1242,7 @@ This API must be called after the `ready` event is emitted.
### `app.applicationMenu`
A `Menu` property that return [`Menu`](menu.md) if one has been set and `null` otherwise.
A `Menu | null` property that returns [`Menu`](menu.md) if one has been set and `null` otherwise.
Users can pass a [Menu](menu.md) to set this property.
### `app.badgeCount` _Linux_ _macOS_
@ -1354,14 +1254,15 @@ On macOS, setting this with any nonzero integer shows on the dock icon. On Linux
**Note:** Unity launcher requires the existence of a `.desktop` file to work,
for more information please read [Desktop Environment Integration][unity-requirement].
### `app.userAgentFallback`
### `app.commandLine`
A `String` which is the user agent string Electron will use as a global fallback.
A [`CommandLine`](./command-line.md) object that allows you to read and manipulate the
command line arguments that Chromium uses.
This is the user agent that will be used when no user agent is set at the
`webContents` or `session` level. Useful for ensuring your entire
app has the same user agent. Set to a custom value as early as possible
in your apps initialization to ensure that your overridden value is used.
### `app.dock` _macOS_
A [`Dock`](./dock.md) object that allows you to perform actions on your app icon in the user's
dock on macOS.
### `app.isPackaged`
@ -1388,3 +1289,12 @@ Usually the `name` field of `package.json` is a short lowercased name, according
to the npm modules spec. You should usually also specify a `productName`
field, which is your application's full capitalized name, and which will be
preferred over `name` by Electron.
### `app.userAgentFallback`
A `String` which is the user agent string Electron will use as a global fallback.
This is the user agent that will be used when no user agent is set at the
`webContents` or `session` level. It is useful for ensuring that your entire
app has the same user agent. Set to a custom value as early as possible
in your app's initialization to ensure that your overridden value is used.

View file

@ -9,7 +9,7 @@ A `BrowserView` can be used to embed additional web content into a
relative to its owning window. It is meant to be an alternative to the
`webview` tag.
## Example
### Example
```javascript
// In the main process.

View file

@ -141,9 +141,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
* `options` Object (optional)
* `width` Integer (optional) - Window's width in pixels. Default is `800`.
* `height` Integer (optional) - Window's height in pixels. Default is `600`.
* `x` Integer (optional) (**required** if y is used) - Window's left offset from screen.
* `x` Integer (optional) - (**required** if y is used) Window's left offset from screen.
Default is to center the window.
* `y` Integer (optional) (**required** if x is used) - Window's top offset from screen.
* `y` Integer (optional) - (**required** if x is used) Window's top offset from screen.
Default is to center the window.
* `useContentSize` Boolean (optional) - The `width` and `height` would be used as web
page's size, which means the actual window's size will include window
@ -1604,7 +1604,7 @@ removed in future Electron releases.
#### `win.setBrowserView(browserView)` _Experimental_
* `browserView` [BrowserView](browser-view.md). Attach browserView to win.
* `browserView` [BrowserView](browser-view.md) - Attach browserView to win.
If there is some other browserViews was attached they will be removed from
this window.

54
docs/api/command-line.md Normal file
View file

@ -0,0 +1,54 @@
## Class: CommandLine
> Manipulate the command line arguments for your app that Chromium reads
Process: [Main](../glossary.md#main-process)
The following example shows how to check if the `--disable-gpu` flag is set.
```javascript
const { app } = require('electron')
app.commandLine.hasSwitch('disable-gpu')
```
For more information on what kinds of flags and switches you can use, check
out the [Chrome Command Line Switches](./chrome-command-line-switches.md)
document.
### Instance Methods
#### `commandLine.appendSwitch(switch[, value])`
* `switch` String - A command-line switch, without the leading `--`
* `value` String (optional) - A value for the given switch
Append a switch (with optional `value`) to Chromium's command line.
**Note:** This will not affect `process.argv`. The intended usage of this function is to
control Chromium's behavior.
#### `commandLine.appendArgument(value)`
* `value` String - The argument to append to the command line
Append an argument to Chromium's command line. The argument will be quoted
correctly. Switches will precede arguments regardless of appending order.
If you're appending an argument like `--switch=value`, consider using `appendSwitch('switch', 'value')` instead.
**Note:** This will not affect `process.argv`. The intended usage of this function is to
control Chromium's behavior.
#### `commandLine.hasSwitch(switch)`
* `switch` String - A command-line switch
Returns `Boolean` - Whether the command-line switch is present.
#### `commandLine.getSwitchValue(switch)`
* `switch` String - A command-line switch
Returns `String` - The command-line switch value.
**Note:** When the switch is not present or has no value, it returns empty string.

View file

@ -32,6 +32,32 @@ win.webContents.debugger.on('message', (event, method, params) => {
win.webContents.debugger.sendCommand('Network.enable')
```
### Instance Events
#### Event: 'detach'
Returns:
* `event` Event
* `reason` String - Reason for detaching debugger.
Emitted when the debugging session is terminated. This happens either when
`webContents` is closed or devtools is invoked for the attached `webContents`.
#### Event: 'message'
Returns:
* `event` Event
* `method` String - Method name.
* `params` Object - Event parameters defined by the 'parameters'
attribute in the remote debugging protocol.
Emitted whenever the debugging target issues an instrumentation event.
[rdp]: https://chromedevtools.github.io/devtools-protocol/
[`webContents.findInPage`]: web-contents.md#contentsfindinpagetext-options
### Instance Methods
#### `debugger.attach([protocolVersion])`
@ -59,25 +85,3 @@ the 'returns' attribute of the command description in the remote debugging proto
or is rejected indicating the failure of the command.
Send given command to the debugging target.
### Instance Events
#### Event: 'detach'
* `event` Event
* `reason` String - Reason for detaching debugger.
Emitted when debugging session is terminated. This happens either when
`webContents` is closed or devtools is invoked for the attached `webContents`.
#### Event: 'message'
* `event` Event
* `method` String - Method name.
* `params` Object - Event parameters defined by the 'parameters'
attribute in the remote debugging protocol.
Emitted whenever debugging target issues instrumentation event.
[rdp]: https://chromedevtools.github.io/devtools-protocol/
[`webContents.findInPage`]: web-contents.md#contentsfindinpagetext-options

View file

@ -93,7 +93,7 @@ Returns `Promise<DesktopCapturerSource[]>` - Resolves with an array of [`Desktop
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia
### Caveats
## Caveats
`navigator.mediaDevices.getUserMedia` does not work on macOS for audio capture due to a fundamental limitation whereby apps that want to access the system's audio require a [signed kernel extension](https://developer.apple.com/library/archive/documentation/Security/Conceptual/System_Integrity_Protection_Guide/KernelExtensions/KernelExtensions.html). Chromium, and by extension Electron, does not provide this.

View file

@ -115,7 +115,7 @@ dialog.showOpenDialogSync(mainWindow, {
Returns `Promise<Object>` - Resolve wih an object containing the following:
* `canceled` - Boolean - whether or not the dialog was canceled.
* `canceled` Boolean - whether or not the dialog was canceled.
* `filePaths` String[] (optional) - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.
* `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated.
@ -198,7 +198,7 @@ The `filters` specifies an array of file types that can be displayed, see
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`.
* `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.
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.

78
docs/api/dock.md Normal file
View file

@ -0,0 +1,78 @@
## Class: Dock
> Control your app in the macOS dock
Process: [Main](../glossary.md#main-process)
The following example shows how to bounce your icon on the dock.
```javascript
const { app } = require('electron')
app.dock.bounce()
```
### Instance Methods
#### `dock.bounce([type])` _macOS_
* `type` String (optional) - Can be `critical` or `informational`. The default is
`informational`
When `critical` is passed, the dock icon will bounce until either the
application becomes active or the request is canceled.
When `informational` is passed, the dock icon will bounce for one second.
However, the request remains active until either the application becomes active
or the request is canceled.
Returns `Integer` an ID representing the request.
#### `dock.cancelBounce(id)` _macOS_
* `id` Integer
Cancel the bounce of `id`.
#### `dock.downloadFinished(filePath)` _macOS_
* `filePath` String
Bounces the Downloads stack if the filePath is inside the Downloads folder.
#### `dock.setBadge(text)` _macOS_
* `text` String
Sets the string to be displayed in the docks badging area.
#### `dock.getBadge()` _macOS_
Returns `String` - The badge string of the dock.
#### `dock.hide()` _macOS_
Hides the dock icon.
#### `dock.show()` _macOS_
Returns `Promise<void>` - Resolves when the dock icon is shown.
#### `dock.isVisible()` _macOS_
Returns `Boolean` - Whether the dock icon is visible.
#### `dock.setMenu(menu)` _macOS_
* `menu` [Menu](menu.md)
Sets the application's [dock menu][dock-menu].
#### `dock.getMenu()` _macOS_
Returns `Menu | null` - The application's [dock menu][dock-menu].
#### `dock.setIcon(image)` _macOS_
* `image` ([NativeImage](native-image.md) | String)
Sets the `image` associated with this dock icon.

View file

@ -40,6 +40,7 @@ only the next time a message is sent to `channel`, after which it is removed.
* `channel` String
* `listener` Function
* `...args` any[]
Removes the specified `listener` from the listener array for the specified
`channel`.

View file

@ -147,7 +147,7 @@ item's submenu, if present.
#### `menuItem.type`
A `String` indicating the type of the item.
A `String` indicating the type of the item. Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
#### `menuItem.role`
@ -155,7 +155,7 @@ A `String` (optional) indicating the item's role, if set.
#### `menuItem.accelerator`
A `String` (optional) indicating the item's accelerator, if set.
A `Accelerator` (optional) indicating the item's accelerator, if set.
#### `menuItem.icon`

View file

@ -223,7 +223,7 @@ Returns `Buffer` - A [Buffer][buffer] that contains the image's `PNG` encoded da
#### `image.toJPEG(quality)`
* `quality` Integer (**required**) - Between 0 - 100.
* `quality` Integer - Between 0 - 100.
Returns `Buffer` - A [Buffer][buffer] that contains the image's `JPEG` encoded data.

View file

@ -206,11 +206,9 @@ Returns `String` - The version of the host operating system.
Examples:
| Platform | Version |
|----------|---------|
| macOS | `10.13.6` |
| Windows | `10.0.17763` |
| Linux | `4.15.0-45-generic` |
* `macOS` -> `10.13.6`
* `Windows` -> `10.0.17763`
* `Linux` -> `4.15.0-45-generic`
**Note:** It returns the actual operating system version instead of kernel version on macOS unlike `os.release()`.

View file

@ -201,7 +201,7 @@ process.
### `remote.process`
The `process` object in the main process. This is the same as
A `NodeJS.Process` object. The `process` object in the main process. This is the same as
`remote.getGlobal('process')` but is cached.
[rmi]: https://en.wikipedia.org/wiki/Java_remote_method_invocation

View file

@ -70,6 +70,8 @@ The following events are available on instances of `Session`:
#### Event: 'will-download'
Returns:
* `event` Event
* `item` [DownloadItem](download-item.md)
* `webContents` [WebContents](web-contents.md)
@ -425,15 +427,15 @@ The following properties are available on instances of `Session`:
#### `ses.cookies`
A [Cookies](cookies.md) object for this session.
A [`Cookies`](cookies.md) object for this session.
#### `ses.webRequest`
A [WebRequest](web-request.md) object for this session.
A [`WebRequest`](web-request.md) object for this session.
#### `ses.protocol`
A [Protocol](protocol.md) object for this session.
A [`Protocol`](protocol.md) object for this session.
```javascript
const { app, session } = require('electron')
@ -452,7 +454,7 @@ app.on('ready', function () {
#### `ses.netLog`
A [NetLog](net-log.md) object for this session.
A [`NetLog`](net-log.md) object for this session.
```javascript
const { app, session } = require('electron')

View file

@ -1,6 +1,6 @@
# ProcessMemoryInfo Object
* `residentSet` Integer _Linux_ and _Windows_ - The amount of memory
* `residentSet` Integer - _Linux_ and _Windows_ - The amount of memory
currently pinned to actual physical RAM in Kilobytes.
* `private` Integer - The amount of memory not shared by other processes, such as
JS heap or HTML content in Kilobytes.

View file

@ -1,7 +1,7 @@
# TraceCategoriesAndOptions Object
* `categoryFilter` String is a filter to control what category groups
should be traced. A filter can have an optional `-` prefix to exclude
* `categoryFilter` String - A filter to control what category groups
should be traced. A filter can have an optional '-' prefix to exclude
category groups that contain a matching category. Having both included
and excluded category patterns in the same list is not supported. Examples:
`test_MyTest*`, `test_MyTest*,test_OtherStuff`, `-excluded_category1,-excluded_category2`.

View file

@ -20,6 +20,44 @@ removed in future Electron releases.
[Touch Bar Simulator](https://github.com/sindresorhus/touch-bar-simulator)
to test Touch Bar usage in your app.
### Static Properties
#### `TouchBarButton`
A [`typeof TouchBarButton`](./touch-bar-button.md) reference to the `TouchBarButton` class.
#### `TouchBarColorPicker`
A [`typeof TouchBarColorPicker`](./touch-bar-color-picker.md) reference to the `TouchBarColorPicker` class.
#### `TouchBarGroup`
A [`typeof TouchBarGroup`](./touch-bar-group.md) reference to the `TouchBarGroup` class.
#### `TouchBarLabel`
A [`typeof TouchBarLabel`](./touch-bar-label.md) reference to the `TouchBarLabel` class.
#### `TouchBarPopover`
A [`typeof TouchBarPopover`](./touch-bar-popover.md) reference to the `TouchBarPopover` class.
#### `TouchBarScrubber`
A [`typeof TouchBarScrubber`](./touch-bar-scrubber.md) reference to the `TouchBarScrubber` class.
#### `TouchBarSegmentedControl`
A [`typeof TouchBarSegmentedControl`](./touch-bar-segmented-control.md) reference to the `TouchBarSegmentedControl` class.
#### `TouchBarSlider`
A [`typeof TouchBarSlider`](./touch-bar-slider.md) reference to the `TouchBarSlider` class.
#### `TouchBarSpacer`
A [`typeof TouchBarSpacer`](./touch-bar-spacer.md) reference to the `TouchBarSpacer` class.
### Instance Properties
The following properties are available on instances of `TouchBar`:

View file

@ -70,6 +70,8 @@ The `Tray` module emits the following events:
#### Event: 'click'
Returns:
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `bounds` [Rectangle](structures/rectangle.md) - The bounds of tray icon.
* `position` [Point](structures/point.md) - The position of the event.
@ -78,6 +80,8 @@ Emitted when the tray icon is clicked.
#### Event: 'right-click' _macOS_ _Windows_
Returns:
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `bounds` [Rectangle](structures/rectangle.md) - The bounds of tray icon.
@ -85,6 +89,8 @@ Emitted when the tray icon is right clicked.
#### Event: 'double-click' _macOS_ _Windows_
Returns:
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `bounds` [Rectangle](structures/rectangle.md) - The bounds of tray icon.
@ -109,6 +115,8 @@ Emitted when any dragged items are dropped on the tray icon.
#### Event: 'drop-files' _macOS_
Returns:
* `event` Event
* `files` String[] - The paths of the dropped files.
@ -116,6 +124,8 @@ Emitted when dragged files are dropped in the tray icon.
#### Event: 'drop-text' _macOS_
Returns:
* `event` Event
* `text` String - the dropped text string.
@ -135,6 +145,8 @@ Emitted when a drag operation ends on the tray or ends at another location.
#### Event: 'mouse-enter' _macOS_
Returns:
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `position` [Point](structures/point.md) - The position of the event.
@ -142,6 +154,8 @@ Emitted when the mouse enters the tray icon.
#### Event: 'mouse-leave' _macOS_
Returns:
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `position` [Point](structures/point.md) - The position of the event.
@ -149,6 +163,8 @@ Emitted when the mouse exits the tray icon.
#### Event: 'mouse-move' _macOS_
Returns:
* `event` [KeyboardEvent](structures/keyboard-event.md)
* `position` [Point](structures/point.md) - The position of the event.
@ -188,8 +204,6 @@ Sets the title displayed next to the tray icon in the status bar (Support ANSI c
#### `tray.getTitle()` _macOS_
* `title` String
Returns `String` - the title displayed next to the tray icon in the status bar
#### `tray.setHighlightMode(mode)` _macOS_

View file

@ -465,6 +465,11 @@ Emitted when media is paused or done playing.
#### Event: 'did-change-theme-color'
Returns:
* `event` Event
* `color` (String | null) - Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
Emitted when a page's theme color changes. This is usually due to encountering
a meta tag:
@ -472,11 +477,6 @@ a meta tag:
<meta name='theme-color' content='#ff0000'>
```
Returns:
* `event` Event
* `color` (String | null) - Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
#### Event: 'update-target-url'
Returns:
@ -1525,7 +1525,7 @@ End subscribing for frame presentation events.
#### `contents.startDrag(item)`
* `item` Object
* `file` String or `files` Array - The path(s) to the file(s) being dragged.
* `file` String[] | String - The path(s) to the file(s) being dragged.
* `icon` [NativeImage](native-image.md) - The image must be non-empty on
macOS.
@ -1674,6 +1674,6 @@ when the DevTools has been closed.
#### `contents.debugger`
A [Debugger](debugger.md) instance for this webContents.
A [`Debugger`](debugger.md) instance for this webContents.
[keyboardevent]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent

View file

@ -67,7 +67,7 @@ Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
* `language` String
* `provider` Object
* `spellCheck` Function.
* `spellCheck` Function
* `words` String[]
* `callback` Function
* `misspeltWords` String[]

View file

@ -100,7 +100,7 @@ The `webview` tag has the following attributes:
<webview src="https://www.github.com/"></webview>
```
Returns the visible URL. Writing to this attribute initiates top-level
A `String` representing the visible URL. Writing to this attribute initiates top-level
navigation.
Assigning `src` its own value will reload the current page.
@ -114,7 +114,7 @@ The `src` attribute can also accept data URLs, such as
<webview src="http://www.google.com/" nodeintegration></webview>
```
When this attribute is present the guest page in `webview` will have node
A `Boolean`. When this attribute is present the guest page in `webview` will have node
integration and can use node APIs like `require` and `process` to access low
level system resources. Node integration is disabled by default in the guest
page.
@ -125,7 +125,7 @@ page.
<webview src="http://www.google.com/" nodeintegrationinsubframes></webview>
```
Experimental option for enabling NodeJS support in sub-frames such as iframes
A `Boolean` for the experimental option for enabling NodeJS support in sub-frames such as iframes
inside the `webview`. All your preloads will load for every iframe, you can
use `process.isMainFrame` to determine if you are in the main frame or not.
This option is disabled by default in the guest page.
@ -136,7 +136,7 @@ This option is disabled by default in the guest page.
<webview src="http://www.google.com/" enableremotemodule="false"></webview>
```
When this attribute is `false` the guest page in `webview` will not have access
A `Boolean`. When this attribute is `false` the guest page in `webview` will not have access
to the [`remote`](remote.md) module. The remote module is available by default.
### `plugins`
@ -145,7 +145,7 @@ to the [`remote`](remote.md) module. The remote module is available by default.
<webview src="https://www.github.com/" plugins></webview>
```
When this attribute is present the guest page in `webview` will be able to use
A `Boolean`. When this attribute is present the guest page in `webview` will be able to use
browser plugins. Plugins are disabled by default.
### `preload`
@ -154,7 +154,7 @@ browser plugins. Plugins are disabled by default.
<webview src="https://www.github.com/" preload="./test.js"></webview>
```
Specifies a script that will be loaded before other scripts run in the guest
A `String` that specifies a script that will be loaded before other scripts run in the guest
page. The protocol of script's URL must be either `file:` or `asar:`, because it
will be loaded by `require` in guest page under the hood.
@ -174,7 +174,7 @@ the `webPreferences` specified to the `will-attach-webview` event.
<webview src="https://www.github.com/" httpreferrer="http://cheng.guru"></webview>
```
Sets the referrer URL for the guest page.
A `String` that sets the referrer URL for the guest page.
### `useragent`
@ -182,7 +182,7 @@ Sets the referrer URL for the guest page.
<webview src="https://www.github.com/" useragent="Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko"></webview>
```
Sets the user agent for the guest page before the page is navigated to. Once the
A `String` that sets the user agent for the guest page before the page is navigated to. Once the
page is loaded, use the `setUserAgent` method to change the user agent.
### `disablewebsecurity`
@ -191,7 +191,7 @@ page is loaded, use the `setUserAgent` method to change the user agent.
<webview src="https://www.github.com/" disablewebsecurity></webview>
```
When this attribute is present the guest page will have web security disabled.
A `Boolean`. When this attribute is present the guest page will have web security disabled.
Web security is enabled by default.
### `partition`
@ -201,7 +201,7 @@ Web security is enabled by default.
<webview src="https://electronjs.org" partition="electron"></webview>
```
Sets the session used by the page. If `partition` starts with `persist:`, the
A `String` that sets the session used by the page. If `partition` starts with `persist:`, the
page will use a persistent session available to all pages in the app with the
same `partition`. if there is no `persist:` prefix, the page will use an
in-memory session. By assigning the same `partition`, multiple pages can share
@ -218,7 +218,7 @@ value will fail with a DOM exception.
<webview src="https://www.github.com/" allowpopups></webview>
```
When this attribute is present the guest page will be allowed to open new
A `Boolean`. When this attribute is present the guest page will be allowed to open new
windows. Popups are disabled by default.
### `webpreferences`
@ -227,7 +227,7 @@ windows. Popups are disabled by default.
<webview src="https://github.com" webpreferences="allowRunningInsecureContent, javascript=no"></webview>
```
A list of strings which specifies the web preferences to be set on the webview, separated by `,`.
A `String` which is a comma separated list of strings which specifies the web preferences to be set on the webview.
The full list of supported preference strings can be found in [BrowserWindow](browser-window.md#new-browserwindowoptions).
The string follows the same format as the features string in `window.open`.
@ -241,7 +241,7 @@ Special values `yes` and `1` are interpreted as `true`, while `no` and `0` are i
<webview src="https://www.github.com/" enableblinkfeatures="PreciseMemoryInfo, CSSVariables"></webview>
```
A list of strings which specifies the blink features to be enabled separated by `,`.
A `String` which is a list of strings which specifies the blink features to be enabled separated by `,`.
The full list of supported feature strings can be found in the
[RuntimeEnabledFeatures.json5][runtime-enabled-features] file.
@ -251,7 +251,7 @@ The full list of supported feature strings can be found in the
<webview src="https://www.github.com/" disableblinkfeatures="PreciseMemoryInfo, CSSVariables"></webview>
```
A list of strings which specifies the blink features to be disabled separated by `,`.
A `String` which is a list of strings which specifies the blink features to be disabled separated by `,`.
The full list of supported feature strings can be found in the
[RuntimeEnabledFeatures.json5][runtime-enabled-features] file.
@ -632,7 +632,7 @@ it is therefore not available when this module is disabled.
Returns `Number` - The WebContents ID of this `webview`.
## DOM events
## DOM Events
The following DOM events are available to the `webview` tag:

View file

@ -11,12 +11,14 @@ auto_filenames = {
"docs/api/chrome-command-line-switches.md",
"docs/api/client-request.md",
"docs/api/clipboard.md",
"docs/api/command-line.md",
"docs/api/content-tracing.md",
"docs/api/cookies.md",
"docs/api/crash-reporter.md",
"docs/api/debugger.md",
"docs/api/desktop-capturer.md",
"docs/api/dialog.md",
"docs/api/dock.md",
"docs/api/download-item.md",
"docs/api/environment-variables.md",
"docs/api/file-object.md",

View file

@ -70,12 +70,12 @@ app._setDefaultAppPaths = (packagePath) => {
}
if (process.platform === 'darwin') {
const setDockMenu = app.dock.setMenu
app.dock.setMenu = (menu) => {
const setDockMenu = app.dock!.setMenu
app.dock!.setMenu = (menu) => {
dockMenu = menu
setDockMenu(menu)
}
app.dock.getMenu = () => dockMenu
app.dock!.getMenu = () => dockMenu
}
// Routes the events to webContents.

View file

@ -4,6 +4,8 @@
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {
"@electron/docs-parser": "^0.1.1",
"@electron/typescript-definitions": "^8.3.1",
"@octokit/rest": "^16.3.2",
"@types/chai": "^4.1.7",
"@types/chai-as-promised": "^7.1.0",
@ -22,8 +24,6 @@
"colors": "^1.1.2",
"dotenv-safe": "^4.0.4",
"dugite": "^1.45.0",
"electron-docs-linter": "^3.0.3",
"electron-typescript-definitions": "^8.3.0",
"eslint": "^5.13.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.17.2",
@ -74,8 +74,8 @@
"lint:docs-relative-links": "python ./script/check-relative-doc-links.py",
"lint:check-trailing-whitespace": "python ./script/check-trailing-whitespace.py",
"lint:js-in-markdown": "standard-markdown docs",
"create-api-json": "electron-docs-linter docs --outfile=electron-api.json",
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --in=electron-api.json --out=electron.d.ts && node spec/ts-smoke/runner.js",
"create-api-json": "electron-docs-parser --dir=./",
"create-typescript-definitions": "npm run create-api-json && electron-typescript-definitions --api=electron-api.json && node spec/ts-smoke/runner.js",
"gn-typescript-definitions": "npm run create-typescript-definitions && shx cp electron.d.ts",
"pre-flight": "pre-flight",
"preinstall": "node -e 'process.exit(0)'",

View file

@ -56,8 +56,12 @@ const main = async () => {
child.stdout.on('data', chunk => {
output += chunk.toString()
})
child.stderr.on('data', chunk => console.error(chunk.toString()))
await new Promise((resolve, reject) => child.on('exit', (code) => {
if (code !== 0) return reject(new Error(`Failed to list browserify dependencies for entry: ${browserifyTarget.name}`))
if (code !== 0) {
console.error(output)
return reject(new Error(`Failed to list browserify dependencies for entry: ${browserifyTarget.name}`))
}
resolve()
}))

View file

@ -1,5 +1,3 @@
import { EventEmitter } from 'electron';
/**
* @fileoverview A set of helper functions to make it easier to work
* with events in async/await manner.
@ -21,11 +19,11 @@ export const waitForEvent = (target: EventTarget, eventName: string) => {
* @param {string} eventName
* @return {!Promise<!Array>} With Event as the first item.
*/
export const emittedOnce = (emitter: EventEmitter, eventName: string) => {
export const emittedOnce = (emitter: NodeJS.EventEmitter, eventName: string) => {
return emittedNTimes(emitter, eventName, 1).then(([result]) => result)
}
export const emittedNTimes = (emitter: EventEmitter, eventName: string, times: number) => {
export const emittedNTimes = (emitter: NodeJS.EventEmitter, eventName: string, times: number) => {
const events: any[][] = []
return new Promise<any[][]>(resolve => {
const handler = (...args: any[]) => {

View file

@ -92,7 +92,7 @@ declare namespace ElectronInternal {
_replyInternal(...args: any[]): void;
}
interface IpcMainInternal extends Electron.EventEmitter {
interface IpcMainInternal extends NodeJS.EventEmitter {
on(channel: string, listener: (event: IpcMainInternalEvent, ...args: any[]) => void): this;
once(channel: string, listener: (event: IpcMainInternalEvent, ...args: any[]) => void): this;
}

1200
yarn.lock

File diff suppressed because it is too large Load diff