From e0e47ea9a1be53efd7636070d3e127ecbf98c995 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Wed, 28 Sep 2016 18:28:44 +1300 Subject: [PATCH] Update docs to contain more specific return values --- docs/api/app.md | 21 ++++++++++++--------- docs/api/browser-window.md | 2 +- docs/api/desktop-capturer.md | 2 +- docs/api/dialog.md | 8 ++++---- docs/api/menu.md | 2 +- docs/api/protocol.md | 4 ++-- docs/api/screen.md | 2 +- docs/api/session.md | 4 ++-- docs/api/tray.md | 2 +- docs/api/web-contents.md | 4 ++-- docs/api/web-view-tag.md | 2 +- 11 files changed, 28 insertions(+), 25 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index 21dca1d1be7d..19f0edd49461 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -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, diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index ce22ee8a0ce4..d970d7d9c8fe 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -1073,7 +1073,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: diff --git a/docs/api/desktop-capturer.md b/docs/api/desktop-capturer.md index af35b11fdeeb..255340aa6429 100644 --- a/docs/api/desktop-capturer.md +++ b/docs/api/desktop-capturer.md @@ -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}`. diff --git a/docs/api/dialog.md b/docs/api/dialog.md index e49dbf75d000..70f8a643f889 100644 --- a/docs/api/dialog.md +++ b/docs/api/dialog.md @@ -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. diff --git a/docs/api/menu.md b/docs/api/menu.md index f516236f76b7..118ecad4fd71 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -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. diff --git a/docs/api/protocol.md b/docs/api/protocol.md index 4e02facaba68..538db54113ff 100644 --- a/docs/api/protocol.md +++ b/docs/api/protocol.md @@ -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])` diff --git a/docs/api/screen.md b/docs/api/screen.md index b052b707a316..55413abc6398 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -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`, diff --git a/docs/api/session.md b/docs/api/session.md index 2fc45fe3a858..4870400724ed 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -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. diff --git a/docs/api/tray.md b/docs/api/tray.md index 29b1331eade6..964f0d8a8306 100644 --- a/docs/api/tray.md +++ b/docs/api/tray.md @@ -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. diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 76d0f7bf23a2..2fdc499b2bbc 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -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`. diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index ff81a9e412a7..512300c9f67c 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -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.