docs: clean up protocol docs (#22262)

* docs: clean up protocol docs

* Fix capitalization
This commit is contained in:
Mark Lee 2020-02-20 09:27:17 -08:00 committed by GitHub
parent 57943f4de3
commit 2e6fff885d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -703,34 +703,34 @@ Clears the recent documents list.
### `app.setAsDefaultProtocolClient(protocol[, path, args])` ### `app.setAsDefaultProtocolClient(protocol[, path, args])`
* `protocol` String - The name of your protocol, without `://`. If you want your * `protocol` String - The name of your protocol, without `://`. For example,
app to handle `electron://` links, call this method with `electron` as the if you want your app to handle `electron://` links, call this method with
parameter. `electron` as the parameter.
* `path` String (optional) _Windows_ - Defaults to `process.execPath` * `path` String (optional) _Windows_ - The path to the Electron executable.
* `args` String[] (optional) _Windows_ - Defaults to an empty array Defaults to `process.execPath`
* `args` String[] (optional) _Windows_ - Arguments passed to the executable.
Defaults to an empty array
Returns `Boolean` - Whether the call succeeded. Returns `Boolean` - Whether the call succeeded.
This method sets the current executable as the default handler for a protocol Sets the current executable as the default handler for a protocol (aka URI
(aka URI scheme). It allows you to integrate your app deeper into the operating scheme). It allows you to integrate your app deeper into the operating system.
system. Once registered, all links with `your-protocol://` will be opened with Once registered, all links with `your-protocol://` will be opened with the
the current executable. The whole link, including protocol, will be passed to current executable. The whole link, including protocol, will be passed to your
your application as a parameter. 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.
**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 cannot be modified at runtime. However, you can
change the file with a simple text editor or script during build time. change the file during build time via [Electron Forge][electron-forge],
Please refer to [Apple's documentation][CFBundleURLTypes] for details. [Electron Packager][electron-packager], or by editing `info.plist` with a text
editor. Please refer to [Apple's documentation][CFBundleURLTypes] for details.
**Note:** In a Windows Store environment (when packaged as an `appx`) this API **Note:** In a Windows Store environment (when packaged as an `appx`) this API
will return `true` for all calls but the registry key it sets won't be accessible will return `true` for all calls but the registry key it sets won't be accessible
by other applications. In order to register your Windows Store application by other applications. In order to register your Windows Store application
as a default protocol handler you must [declare the protocol in your manifest](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol). as a default protocol handler you must [declare the protocol in your manifest](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-uap-protocol).
The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally. The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme` internally.
### `app.removeAsDefaultProtocolClient(protocol[, path, args])` _macOS_ _Windows_ ### `app.removeAsDefaultProtocolClient(protocol[, path, args])` _macOS_ _Windows_
@ -749,10 +749,8 @@ protocol (aka URI scheme). If so, it will remove the app as the default handler.
* `path` String (optional) _Windows_ - Defaults to `process.execPath` * `path` String (optional) _Windows_ - Defaults to `process.execPath`
* `args` String[] (optional) _Windows_ - Defaults to an empty array * `args` String[] (optional) _Windows_ - Defaults to an empty array
Returns `Boolean` Returns `Boolean` - Whether the current executable is the default handler for a
protocol (aka URI scheme).
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.
**Note:** On macOS, you can use this method to check if the app has been **Note:** On macOS, you can use this method to check if the app has been
registered as the default protocol handler for a protocol. You can also verify registered as the default protocol handler for a protocol. You can also verify
@ -760,7 +758,7 @@ this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
macOS machine. Please refer to macOS machine. Please refer to
[Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details. [Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details.
The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme` internally.
### `app.getApplicationNameForProtocol(url)` ### `app.getApplicationNameForProtocol(url)`
@ -1327,6 +1325,8 @@ A `Boolean` property that returns `true` if the app is packaged, `false` otherw
[dock-menu]:https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/ [dock-menu]:https://developer.apple.com/macos/human-interface-guidelines/menus/dock-menus/
[tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks [tasks]:https://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx [app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
[electron-forge]: https://www.electronforge.io/
[electron-packager]: https://github.com/electron/electron-packager
[CFBundleURLTypes]: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115 [CFBundleURLTypes]: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102207-TPXREF115
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme [LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html [handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html