Merge pull request #6858 from electron/default-protocol-launch-args

Allow settings of launch args when using defaultProtocol
This commit is contained in:
Cheng Zhao 2016-08-22 09:32:54 +09:00 committed by GitHub
commit 8b9fd8a76e
5 changed files with 76 additions and 35 deletions

View file

@ -448,11 +448,13 @@ bar, and on macOS you can visit it from dock menu.
Clears the recent documents list.
### `app.setAsDefaultProtocolClient(protocol)` _macOS_ _Windows_
### `app.setAsDefaultProtocolClient(protocol[, path, args])` _macOS_ _Windows_
* `protocol` String - The name of your protocol, without `://`. If you want your
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
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
@ -460,6 +462,9 @@ system. Once registered, all links with `your-protocol://` will be opened with
the current executable. The whole link, including protocol, will be passed to
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
@ -469,18 +474,22 @@ Please refer to [Apple's documentation][CFBundleURLTypes] for details.
The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
### `app.removeAsDefaultProtocolClient(protocol)` _macOS_ _Windows_
### `app.removeAsDefaultProtocolClient(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
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)` _macOS_ _Windows_
### `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
This method checks if the current executable is the default handler for a protocol
(aka URI scheme). If so, it will return true. Otherwise, it will return false.