зеркало из https://github.com/electron/electron.git
Merge pull request #7374 from electron/fixup-return-values
Update docs to contain more specific return values
This commit is contained in:
Коммит
e1d68fa3cd
|
@ -329,7 +329,7 @@ and `will-quit` events will not be emitted.
|
|||
### `app.relaunch([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `args` Array (optional)
|
||||
* `args` String[] (optional)
|
||||
* `execPath` String (optional)
|
||||
|
||||
Relaunches the app when current instance exits.
|
||||
|
@ -470,7 +470,9 @@ Clears the recent documents list.
|
|||
app to handle `electron://` links, call this method with `electron` as the
|
||||
parameter.
|
||||
* `path` String (optional) _Windows_ - Defaults to `process.execPath`
|
||||
* `args` Array (optional) _Windows_ - Defaults to an empty array
|
||||
* `args` String[] (optional) _Windows_ - Defaults to an empty array
|
||||
|
||||
Returns `Boolean` - Whether the call succeeded.
|
||||
|
||||
This method sets the current executable as the default handler for a protocol
|
||||
(aka URI scheme). It allows you to integrate your app deeper into the operating
|
||||
|
@ -481,8 +483,6 @@ your application as a parameter.
|
|||
On Windows you can provide optional parameters path, the path to your executable,
|
||||
and args, an array of arguments to be passed to your executable when it launches.
|
||||
|
||||
Returns `true` when the call succeeded, otherwise returns `false`.
|
||||
|
||||
**Note:** On macOS, you can only register protocols that have been added to
|
||||
your app's `info.plist`, which can not be modified at runtime. You can however
|
||||
change the file with a simple text editor or script during build time.
|
||||
|
@ -494,18 +494,19 @@ The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally
|
|||
|
||||
* `protocol` String - The name of your protocol, without `://`.
|
||||
* `path` String (optional) _Windows_ - Defaults to `process.execPath`
|
||||
* `args` Array (optional) _Windows_ - Defaults to an empty array
|
||||
* `args` String[] (optional) _Windows_ - Defaults to an empty array
|
||||
|
||||
Returns `Boolean` - Whether the call succeeded.
|
||||
|
||||
This method checks if the current executable as the default handler for a
|
||||
protocol (aka URI scheme). If so, it will remove the app as the default handler.
|
||||
|
||||
Returns `true` when the call succeeded, otherwise returns `false`.
|
||||
|
||||
### `app.isDefaultProtocolClient(protocol[, path, args])` _macOS_ _Windows_
|
||||
|
||||
* `protocol` String - The name of your protocol, without `://`.
|
||||
* `path` String (optional) _Windows_ - Defaults to `process.execPath`
|
||||
* `args` Array (optional) _Windows_ - Defaults to an empty array
|
||||
* `args` String[] (optional) _Windows_ - Defaults to an empty array
|
||||
|
||||
Returns `Boolean`
|
||||
|
||||
|
@ -543,7 +544,7 @@ Adds `tasks` to the [Tasks][tasks] category of the JumpList on Windows.
|
|||
consists of two or more icons, set this value to identify the icon. If an
|
||||
icon file consists of one icon, this value is 0.
|
||||
|
||||
Returns `true` when the call succeeded, otherwise returns `false`.
|
||||
Returns `Boolean` - Whether the call succeeded.
|
||||
|
||||
**Note:** If you'd like to customize the Jump List even more use
|
||||
`app.setJumpList(categories)` instead.
|
||||
|
@ -790,8 +791,10 @@ This method can only be called before app is ready.
|
|||
|
||||
* `count` Integer
|
||||
|
||||
Returns `Boolean` - Whether the call succeeded.
|
||||
|
||||
Sets the counter badge for current app. Setting the count to `0` will hide the
|
||||
badge. Returns `true` when the call succeeded, otherwise returns `false`.
|
||||
badge.
|
||||
|
||||
On macOS it shows on the dock icon. On Linux it only works for Unity launcher,
|
||||
|
||||
|
|
|
@ -1077,7 +1077,7 @@ The `buttons` is an array of `Button` objects:
|
|||
toolbar.
|
||||
* `click` Function
|
||||
* `tooltip` String (optional) - The text of the button's tooltip.
|
||||
* `flags` Array (optional) - Control specific states and behaviors of the
|
||||
* `flags` String[] (optional) - Control specific states and behaviors of the
|
||||
button. By default, it is `['enabled']`.
|
||||
|
||||
The `flags` is an array that can include following `String`s:
|
||||
|
|
|
@ -56,7 +56,7 @@ The `desktopCapturer` module has the following methods:
|
|||
### `desktopCapturer.getSources(options, callback)`
|
||||
|
||||
* `options` Object
|
||||
* `types` Array - An array of String that lists the types of desktop sources
|
||||
* `types` String[] - An array of Strings that lists the types of desktop sources
|
||||
to be captured, available types are `screen` and `window`.
|
||||
* `thumbnailSize` Object (optional) - The suggested size that the media source
|
||||
thumbnail should be scaled to, defaults to `{width: 150, height: 150}`.
|
||||
|
|
|
@ -29,8 +29,8 @@ The `dialog` module has the following methods:
|
|||
* `defaultPath` String
|
||||
* `buttonLabel` String - Custom label for the confirmation button, when
|
||||
left empty the default label will be used.
|
||||
* `filters` Array
|
||||
* `properties` Array - Contains which features the dialog should use, can
|
||||
* `filters` String[]
|
||||
* `properties` String[] - Contains which features the dialog should use, can
|
||||
contain `openFile`, `openDirectory`, `multiSelections`, `createDirectory`
|
||||
and `showHiddenFiles`.
|
||||
* `callback` Function (optional)
|
||||
|
@ -72,7 +72,7 @@ shown.
|
|||
* `defaultPath` String
|
||||
* `buttonLabel` String - Custom label for the confirmation button, when
|
||||
left empty the default label will be used.
|
||||
* `filters` Array
|
||||
* `filters` String[]
|
||||
* `callback` Function (optional)
|
||||
|
||||
On success this method returns the path of the file chosen by the user,
|
||||
|
@ -91,7 +91,7 @@ will be passed via `callback(filename)`
|
|||
* `type` String - Can be `"none"`, `"info"`, `"error"`, `"question"` or
|
||||
`"warning"`. On Windows, "question" displays the same icon as "info", unless
|
||||
you set an icon using the "icon" option.
|
||||
* `buttons` Array - Array of texts for buttons. On Windows, an empty array
|
||||
* `buttons` String[] - Array of texts for buttons. On Windows, an empty array
|
||||
will result in one button labeled "OK".
|
||||
* `defaultId` Integer - Index of the button in the buttons array which will
|
||||
be selected by default when the message box opens.
|
||||
|
|
|
@ -252,7 +252,7 @@ for more information on macOS' native actions.
|
|||
|
||||
#### `Menu.buildFromTemplate(template)`
|
||||
|
||||
* `template` Array
|
||||
* `template` MenuItem[]
|
||||
|
||||
Generally, the `template` is just an array of `options` for constructing a
|
||||
[MenuItem](menu-item.md). The usage can be referenced above.
|
||||
|
|
|
@ -28,7 +28,7 @@ The `protocol` module has the following methods:
|
|||
|
||||
### `protocol.registerStandardSchemes(schemes)`
|
||||
|
||||
* `schemes` Array - Custom schemes to be registered as standard schemes.
|
||||
* `schemes` String[] - Custom schemes to be registered as standard schemes.
|
||||
|
||||
A standard scheme adheres to what RFC 3986 calls [generic URI
|
||||
syntax](https://tools.ietf.org/html/rfc3986#section-3). For example `http` and
|
||||
|
@ -70,7 +70,7 @@ module gets emitted.
|
|||
|
||||
### `protocol.registerServiceWorkerSchemes(schemes)`
|
||||
|
||||
* `schemes` Array - Custom schemes to be registered to handle service workers.
|
||||
* `schemes` String[] - Custom schemes to be registered to handle service workers.
|
||||
|
||||
### `protocol.registerFileProtocol(scheme, handler[, completion])`
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ Returns:
|
|||
|
||||
* `event` Event
|
||||
* `display` Object
|
||||
* `changedMetrics` Array
|
||||
* `changedMetrics` String[]
|
||||
|
||||
Emitted when one or more metrics change in a `display`. The `changedMetrics` is
|
||||
an array of strings that describe the changes. Possible changes are `bounds`,
|
||||
|
|
|
@ -107,10 +107,10 @@ Clears the session’s HTTP cache.
|
|||
* `options` Object (optional)
|
||||
* `origin` String - Should follow `window.location.origin`’s representation
|
||||
`scheme://host:port`.
|
||||
* `storages` Array - The types of storages to clear, can contain:
|
||||
* `storages` String[] - The types of storages to clear, can contain:
|
||||
`appcache`, `cookies`, `filesystem`, `indexdb`, `local storage`,
|
||||
`shadercache`, `websql`, `serviceworkers`
|
||||
* `quotas` Array - The types of quotas to clear, can contain:
|
||||
* `quotas` String[] - The types of quotas to clear, can contain:
|
||||
`temporary`, `persistent`, `syncable`.
|
||||
* `callback` Function (optional) - Called when operation is done.
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ Emitted when any dragged items are dropped on the tray icon.
|
|||
#### Event: 'drop-files' _macOS_
|
||||
|
||||
* `event` Event
|
||||
* `files` Array - the file path of dropped files.
|
||||
* `files` String[] - The paths of the dropped files.
|
||||
|
||||
Emitted when dragged files are dropped in the tray icon.
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ Emitted when the document in the given frame is loaded.
|
|||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `favicons` Array - Array of URLs
|
||||
* `favicons` String[] - Array of URLs
|
||||
|
||||
Emitted when page receives favicon urls.
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
|
|||
* `type` String (**required**) - The type of the event, can be `mouseDown`,
|
||||
`mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`,
|
||||
`mouseMove`, `keyDown`, `keyUp`, `char`.
|
||||
* `modifiers` Array - An array of modifiers of the event, can
|
||||
* `modifiers` String[] - An array of modifiers of the event, can
|
||||
include `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
|
||||
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
|
||||
`numLock`, `left`, `right`.
|
||||
|
|
|
@ -622,7 +622,7 @@ title is synthesized from file url.
|
|||
|
||||
Returns:
|
||||
|
||||
* `favicons` Array - Array of URLs.
|
||||
* `favicons` String[] - Array of URLs.
|
||||
|
||||
Fired when page receives favicon urls.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче