Merge pull request #7374 from electron/fixup-return-values

Update docs to contain more specific return values
This commit is contained in:
Cheng Zhao 2016-09-29 16:44:08 +08:00 committed by GitHub
commit e1d68fa3cd
11 changed files with 28 additions and 25 deletions

View file

@ -329,7 +329,7 @@ and `will-quit` events will not be emitted.
### `app.relaunch([options])` ### `app.relaunch([options])`
* `options` Object (optional) * `options` Object (optional)
* `args` Array (optional) * `args` String[] (optional)
* `execPath` String (optional) * `execPath` String (optional)
Relaunches the app when current instance exits. 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 app to handle `electron://` links, call this method with `electron` as the
parameter. parameter.
* `path` String (optional) _Windows_ - Defaults to `process.execPath` * `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 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 (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, 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. 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 **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 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. 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 `://`. * `protocol` String - The name of your protocol, without `://`.
* `path` String (optional) _Windows_ - Defaults to `process.execPath` * `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 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. 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_ ### `app.isDefaultProtocolClient(protocol[, path, args])` _macOS_ _Windows_
* `protocol` String - The name of your protocol, without `://`. * `protocol` String - The name of your protocol, without `://`.
* `path` String (optional) _Windows_ - Defaults to `process.execPath` * `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` 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 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. 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 **Note:** If you'd like to customize the Jump List even more use
`app.setJumpList(categories)` instead. `app.setJumpList(categories)` instead.
@ -790,8 +791,10 @@ This method can only be called before app is ready.
* `count` Integer * `count` Integer
Returns `Boolean` - Whether the call succeeded.
Sets the counter badge for current app. Setting the count to `0` will hide the 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, On macOS it shows on the dock icon. On Linux it only works for Unity launcher,

View file

@ -1077,7 +1077,7 @@ The `buttons` is an array of `Button` objects:
toolbar. toolbar.
* `click` Function * `click` Function
* `tooltip` String (optional) - The text of the button's tooltip. * `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']`. button. By default, it is `['enabled']`.
The `flags` is an array that can include following `String`s: The `flags` is an array that can include following `String`s:

View file

@ -56,7 +56,7 @@ The `desktopCapturer` module has the following methods:
### `desktopCapturer.getSources(options, callback)` ### `desktopCapturer.getSources(options, callback)`
* `options` Object * `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`. to be captured, available types are `screen` and `window`.
* `thumbnailSize` Object (optional) - The suggested size that the media source * `thumbnailSize` Object (optional) - The suggested size that the media source
thumbnail should be scaled to, defaults to `{width: 150, height: 150}`. thumbnail should be scaled to, defaults to `{width: 150, height: 150}`.

View file

@ -29,8 +29,8 @@ The `dialog` module has the following methods:
* `defaultPath` String * `defaultPath` String
* `buttonLabel` String - Custom label for the confirmation button, when * `buttonLabel` String - Custom label for the confirmation button, when
left empty the default label will be used. left empty the default label will be used.
* `filters` Array * `filters` String[]
* `properties` Array - Contains which features the dialog should use, can * `properties` String[] - Contains which features the dialog should use, can
contain `openFile`, `openDirectory`, `multiSelections`, `createDirectory` contain `openFile`, `openDirectory`, `multiSelections`, `createDirectory`
and `showHiddenFiles`. and `showHiddenFiles`.
* `callback` Function (optional) * `callback` Function (optional)
@ -72,7 +72,7 @@ shown.
* `defaultPath` String * `defaultPath` String
* `buttonLabel` String - Custom label for the confirmation button, when * `buttonLabel` String - Custom label for the confirmation button, when
left empty the default label will be used. left empty the default label will be used.
* `filters` Array * `filters` String[]
* `callback` Function (optional) * `callback` Function (optional)
On success this method returns the path of the file chosen by the user, 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 * `type` String - Can be `"none"`, `"info"`, `"error"`, `"question"` or
`"warning"`. On Windows, "question" displays the same icon as "info", unless `"warning"`. On Windows, "question" displays the same icon as "info", unless
you set an icon using the "icon" option. 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". will result in one button labeled "OK".
* `defaultId` Integer - Index of the button in the buttons array which will * `defaultId` Integer - Index of the button in the buttons array which will
be selected by default when the message box opens. be selected by default when the message box opens.

View file

@ -252,7 +252,7 @@ for more information on macOS' native actions.
#### `Menu.buildFromTemplate(template)` #### `Menu.buildFromTemplate(template)`
* `template` Array * `template` MenuItem[]
Generally, the `template` is just an array of `options` for constructing a Generally, the `template` is just an array of `options` for constructing a
[MenuItem](menu-item.md). The usage can be referenced above. [MenuItem](menu-item.md). The usage can be referenced above.

View file

@ -28,7 +28,7 @@ The `protocol` module has the following methods:
### `protocol.registerStandardSchemes(schemes)` ### `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 A standard scheme adheres to what RFC 3986 calls [generic URI
syntax](https://tools.ietf.org/html/rfc3986#section-3). For example `http` and syntax](https://tools.ietf.org/html/rfc3986#section-3). For example `http` and
@ -70,7 +70,7 @@ module gets emitted.
### `protocol.registerServiceWorkerSchemes(schemes)` ### `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])` ### `protocol.registerFileProtocol(scheme, handler[, completion])`

View file

@ -94,7 +94,7 @@ Returns:
* `event` Event * `event` Event
* `display` Object * `display` Object
* `changedMetrics` Array * `changedMetrics` String[]
Emitted when one or more metrics change in a `display`. The `changedMetrics` is 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`, an array of strings that describe the changes. Possible changes are `bounds`,

View file

@ -107,10 +107,10 @@ Clears the sessions HTTP cache.
* `options` Object (optional) * `options` Object (optional)
* `origin` String - Should follow `window.location.origin`s representation * `origin` String - Should follow `window.location.origin`s representation
`scheme://host:port`. `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`, `appcache`, `cookies`, `filesystem`, `indexdb`, `local storage`,
`shadercache`, `websql`, `serviceworkers` `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`. `temporary`, `persistent`, `syncable`.
* `callback` Function (optional) - Called when operation is done. * `callback` Function (optional) - Called when operation is done.

View file

@ -128,7 +128,7 @@ Emitted when any dragged items are dropped on the tray icon.
#### Event: 'drop-files' _macOS_ #### Event: 'drop-files' _macOS_
* `event` Event * `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. Emitted when dragged files are dropped in the tray icon.

View file

@ -132,7 +132,7 @@ Emitted when the document in the given frame is loaded.
Returns: Returns:
* `event` Event * `event` Event
* `favicons` Array - Array of URLs * `favicons` String[] - Array of URLs
Emitted when page receives favicon 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`, * `type` String (**required**) - The type of the event, can be `mouseDown`,
`mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`, `mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`,
`mouseMove`, `keyDown`, `keyUp`, `char`. `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`, include `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`, `leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
`numLock`, `left`, `right`. `numLock`, `left`, `right`.

View file

@ -622,7 +622,7 @@ title is synthesized from file url.
Returns: Returns:
* `favicons` Array - Array of URLs. * `favicons` String[] - Array of URLs.
Fired when page receives favicon urls. Fired when page receives favicon urls.