docs: type names changed from wrapper to primitive (#31752)

This commit is contained in:
Milan Burda 2021-11-16 05:13:18 +01:00 committed by GitHub
parent 246884c4fb
commit e6b1d95a1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
115 changed files with 1685 additions and 1685 deletions

View file

@ -18,7 +18,7 @@ The `systemPreferences` object emits the following events:
Returns:
* `event` Event
* `newColor` String - The new RGBA color the user assigned to be their system
* `newColor` string - The new RGBA color the user assigned to be their system
accent color.
### Event: 'color-changed' _Windows_
@ -32,7 +32,7 @@ Returns:
Returns:
* `event` Event
* `invertedColorScheme` Boolean - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, `false` otherwise.
* `invertedColorScheme` boolean - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is being used, `false` otherwise.
**Deprecated:** Should use the new [`updated`](native-theme.md#event-updated) event on the `nativeTheme` module.
@ -41,7 +41,7 @@ Returns:
Returns:
* `event` Event
* `highContrastColorScheme` Boolean - `true` if a high contrast theme is being used, `false` otherwise.
* `highContrastColorScheme` boolean - `true` if a high contrast theme is being used, `false` otherwise.
**Deprecated:** Should use the new [`updated`](native-theme.md#event-updated) event on the `nativeTheme` module.
@ -49,48 +49,48 @@ Returns:
### `systemPreferences.isDarkMode()` _macOS_ _Windows_ _Deprecated_
Returns `Boolean` - Whether the system is in Dark Mode.
Returns `boolean` - Whether the system is in Dark Mode.
**Deprecated:** Should use the new [`nativeTheme.shouldUseDarkColors`](native-theme.md#nativethemeshouldusedarkcolors-readonly) API.
### `systemPreferences.isSwipeTrackingFromScrollEventsEnabled()` _macOS_
Returns `Boolean` - Whether the Swipe between pages setting is on.
Returns `boolean` - Whether the Swipe between pages setting is on.
### `systemPreferences.postNotification(event, userInfo[, deliverImmediately])` _macOS_
* `event` String
* `userInfo` Record<String, any>
* `deliverImmediately` Boolean (optional) - `true` to post notifications immediately even when the subscribing app is inactive.
* `event` string
* `userInfo` Record<string, any>
* `deliverImmediately` boolean (optional) - `true` to post notifications immediately even when the subscribing app is inactive.
Posts `event` as native notifications of macOS. The `userInfo` is an Object
that contains the user information dictionary sent along with the notification.
### `systemPreferences.postLocalNotification(event, userInfo)` _macOS_
* `event` String
* `userInfo` Record<String, any>
* `event` string
* `userInfo` Record<string, any>
Posts `event` as native notifications of macOS. The `userInfo` is an Object
that contains the user information dictionary sent along with the notification.
### `systemPreferences.postWorkspaceNotification(event, userInfo)` _macOS_
* `event` String
* `userInfo` Record<String, any>
* `event` string
* `userInfo` Record<string, any>
Posts `event` as native notifications of macOS. The `userInfo` is an Object
that contains the user information dictionary sent along with the notification.
### `systemPreferences.subscribeNotification(event, callback)` _macOS_
* `event` String
* `event` string
* `callback` Function
* `event` String
* `userInfo` Record<String, unknown>
* `object` String
* `event` string
* `userInfo` Record<string, unknown>
* `object` string
Returns `Number` - The ID of this subscription
Returns `number` - The ID of this subscription
Subscribes to native notifications of macOS, `callback` will be called with
`callback(event, userInfo)` when the corresponding `event` happens. The
@ -111,26 +111,26 @@ example values of `event` are:
### `systemPreferences.subscribeLocalNotification(event, callback)` _macOS_
* `event` String
* `event` string
* `callback` Function
* `event` String
* `userInfo` Record<String, unknown>
* `object` String
* `event` string
* `userInfo` Record<string, unknown>
* `object` string
Returns `Number` - The ID of this subscription
Returns `number` - The ID of this subscription
Same as `subscribeNotification`, but uses `NSNotificationCenter` for local defaults.
This is necessary for events such as `NSUserDefaultsDidChangeNotification`.
### `systemPreferences.subscribeWorkspaceNotification(event, callback)` _macOS_
* `event` String
* `event` string
* `callback` Function
* `event` String
* `userInfo` Record<String, unknown>
* `object` String
* `event` string
* `userInfo` Record<string, unknown>
* `object` string
Returns `Number` - The ID of this subscription
Returns `number` - The ID of this subscription
Same as `subscribeNotification`, but uses `NSWorkspace.sharedWorkspace.notificationCenter`.
This is necessary for events such as `NSWorkspaceDidActivateApplicationNotification`.
@ -155,13 +155,13 @@ Same as `unsubscribeNotification`, but removes the subscriber from `NSWorkspace.
### `systemPreferences.registerDefaults(defaults)` _macOS_
* `defaults` Record<String, String | Boolean | Number> - a dictionary of (`key: value`) user defaults
* `defaults` Record<string, string | boolean | number> - a dictionary of (`key: value`) user defaults
Add the specified defaults to your application's `NSUserDefaults`.
### `systemPreferences.getUserDefault<Type extends keyof UserDefaultTypes>(key, type)` _macOS_
* `key` String
* `key` string
* `type` Type - Can be `string`, `boolean`, `integer`, `float`, `double`,
`url`, `array` or `dictionary`.
@ -179,9 +179,9 @@ Some popular `key` and `type`s are:
### `systemPreferences.setUserDefault(key, type, value)` _macOS_
* `key` String
* `type` String - Can be `string`, `boolean`, `integer`, `float`, `double`, `url`, `array` or `dictionary`.
* `value` String
* `key` string
* `type` string - Can be `string`, `boolean`, `integer`, `float`, `double`, `url`, `array` or `dictionary`.
* `value` string
Set the value of `key` in `NSUserDefaults`.
@ -194,14 +194,14 @@ Some popular `key` and `type`s are:
### `systemPreferences.removeUserDefault(key)` _macOS_
* `key` String
* `key` string
Removes the `key` in `NSUserDefaults`. This can be used to restore the default
or global value of a `key` previously set with `setUserDefault`.
### `systemPreferences.isAeroGlassEnabled()` _Windows_
Returns `Boolean` - `true` if [DWM composition][dwm-composition] (Aero Glass) is
Returns `boolean` - `true` if [DWM composition][dwm-composition] (Aero Glass) is
enabled, and `false` otherwise.
An example of using it to determine if you should create a transparent window or
@ -233,7 +233,7 @@ if (browserOptions.transparent) {
### `systemPreferences.getAccentColor()` _Windows_ _macOS_
Returns `String` - The users current system wide accent color preference in RGBA
Returns `string` - The users current system wide accent color preference in RGBA
hexadecimal form.
```js
@ -248,7 +248,7 @@ This API is only available on macOS 10.14 Mojave or newer.
### `systemPreferences.getColor(color)` _Windows_ _macOS_
* `color` String - One of the following values:
* `color` string - One of the following values:
* On **Windows**:
* `3d-dark-shadow` - Dark shadow for three-dimensional display elements.
* `3d-face` - Face color for three-dimensional display elements and for dialog
@ -325,7 +325,7 @@ This API is only available on macOS 10.14 Mojave or newer.
* `window-background` - The background of a window.
* `window-frame-text` - The text in the window's titlebar area.
Returns `String` - The system color setting in RGB hexadecimal form (`#ABCDEF`).
Returns `string` - The system color setting in RGB hexadecimal form (`#ABCDEF`).
See the [Windows docs][windows-colors] and the [macOS docs][macos-colors] for more details.
The following colors are only available on macOS 10.14: `find-highlight`, `selected-content-background`, `separator`, `unemphasized-selected-content-background`, `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
@ -335,7 +335,7 @@ The following colors are only available on macOS 10.14: `find-highlight`, `selec
### `systemPreferences.getSystemColor(color)` _macOS_
* `color` String - One of the following values:
* `color` string - One of the following values:
* `blue`
* `brown`
* `gray`
@ -346,32 +346,32 @@ The following colors are only available on macOS 10.14: `find-highlight`, `selec
* `red`
* `yellow`
Returns `String` - The standard system color formatted as `#RRGGBBAA`.
Returns `string` - The standard system color formatted as `#RRGGBBAA`.
Returns one of several standard system colors that automatically adapt to vibrancy and changes in accessibility settings like 'Increase contrast' and 'Reduce transparency'. See [Apple Documentation](https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/color#system-colors) for more details.
### `systemPreferences.isInvertedColorScheme()` _Windows_ _Deprecated_
Returns `Boolean` - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, `false` otherwise.
Returns `boolean` - `true` if an inverted color scheme (a high contrast color scheme with light text and dark backgrounds) is active, `false` otherwise.
**Deprecated:** Should use the new [`nativeTheme.shouldUseInvertedColorScheme`](native-theme.md#nativethemeshoulduseinvertedcolorscheme-macos-windows-readonly) API.
### `systemPreferences.isHighContrastColorScheme()` _macOS_ _Windows_ _Deprecated_
Returns `Boolean` - `true` if a high contrast theme is active, `false` otherwise.
Returns `boolean` - `true` if a high contrast theme is active, `false` otherwise.
**Deprecated:** Should use the new [`nativeTheme.shouldUseHighContrastColors`](native-theme.md#nativethemeshouldusehighcontrastcolors-macos-windows-readonly) API.
### `systemPreferences.getEffectiveAppearance()` _macOS_
Returns `String` - Can be `dark`, `light` or `unknown`.
Returns `string` - Can be `dark`, `light` or `unknown`.
Gets the macOS appearance setting that is currently applied to your application,
maps to [NSApplication.effectiveAppearance](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc)
### `systemPreferences.getAppLevelAppearance()` _macOS_ _Deprecated_
Returns `String` | `null` - Can be `dark`, `light` or `unknown`.
Returns `string` | `null` - Can be `dark`, `light` or `unknown`.
Gets the macOS appearance setting that you have declared you want for
your application, maps to [NSApplication.appearance](https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc).
@ -379,20 +379,20 @@ You can use the `setAppLevelAppearance` API to set this value.
### `systemPreferences.setAppLevelAppearance(appearance)` _macOS_ _Deprecated_
* `appearance` String | null - Can be `dark` or `light`
* `appearance` string | null - Can be `dark` or `light`
Sets the appearance setting for your application, this should override the
system default and override the value of `getEffectiveAppearance`.
### `systemPreferences.canPromptTouchID()` _macOS_
Returns `Boolean` - whether or not this device has the ability to use Touch ID.
Returns `boolean` - whether or not this device has the ability to use Touch ID.
**NOTE:** This API will return `false` on macOS systems older than Sierra 10.12.2.
### `systemPreferences.promptTouchID(reason)` _macOS_
* `reason` String - The reason you are asking for Touch ID authentication
* `reason` string - The reason you are asking for Touch ID authentication
Returns `Promise<void>` - resolves if the user has successfully authenticated with Touch ID.
@ -412,15 +412,15 @@ This API itself will not protect your user data; rather, it is a mechanism to al
### `systemPreferences.isTrustedAccessibilityClient(prompt)` _macOS_
* `prompt` Boolean - whether or not the user will be informed via prompt if the current process is untrusted.
* `prompt` boolean - whether or not the user will be informed via prompt if the current process is untrusted.
Returns `Boolean` - `true` if the current process is a trusted accessibility client and `false` if it is not.
Returns `boolean` - `true` if the current process is a trusted accessibility client and `false` if it is not.
### `systemPreferences.getMediaAccessStatus(mediaType)` _Windows_ _macOS_
* `mediaType` String - Can be `microphone`, `camera` or `screen`.
* `mediaType` string - Can be `microphone`, `camera` or `screen`.
Returns `String` - Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
Returns `string` - Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
This user consent was not required on macOS 10.13 High Sierra or lower so this method will always return `granted`.
macOS 10.14 Mojave or higher requires consent for `microphone` and `camera` access.
@ -431,9 +431,9 @@ It will always return `granted` for `screen` and for all media types on older ve
### `systemPreferences.askForMediaAccess(mediaType)` _macOS_
* `mediaType` String - the type of media being requested; can be `microphone`, `camera`.
* `mediaType` string - the type of media being requested; can be `microphone`, `camera`.
Returns `Promise<Boolean>` - A promise that resolves with `true` if consent was granted and `false` if it was denied. If an invalid `mediaType` is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it _must_ be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.
Returns `Promise<boolean>` - A promise that resolves with `true` if consent was granted and `false` if it was denied. If an invalid `mediaType` is passed, the promise will be rejected. If an access request was denied and later is changed through the System Preferences pane, a restart of the app will be required for the new permissions to take effect. If access has already been requested and denied, it _must_ be changed through the preference pane; an alert will not pop up and the promise will resolve with the existing access status.
**Important:** In order to properly leverage this API, you [must set](https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos?language=objc) the `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your app's `Info.plist` file. The values for these keys will be used to populate the permission dialogs so that the user will be properly informed as to the purpose of the permission request. See [Electron Application Distribution](../tutorial/application-distribution.md#macos) for more information about how to set these in the context of Electron.
@ -443,9 +443,9 @@ This user consent was not required until macOS 10.14 Mojave, so this method will
Returns `Object`:
* `shouldRenderRichAnimation` Boolean - Returns true if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.
* `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.
* `prefersReducedMotion` Boolean - Determines whether the user desires reduced motion based on platform APIs.
* `shouldRenderRichAnimation` boolean - Returns true if rich animations should be rendered. Looks at session type (e.g. remote desktop) and accessibility settings to give guidance for heavy animations.
* `scrollAnimationsEnabledBySystem` boolean - Determines on a per-platform basis whether scroll animations (e.g. produced by home/end key) should be enabled.
* `prefersReducedMotion` boolean - Determines whether the user desires reduced motion based on platform APIs.
Returns an object with system animation settings.
@ -453,7 +453,7 @@ Returns an object with system animation settings.
### `systemPreferences.appLevelAppearance` _macOS_
A `String` property that can be `dark`, `light` or `unknown`. It determines the macOS appearance setting for
A `string` property that can be `dark`, `light` or `unknown`. It determines the macOS appearance setting for
your application. This maps to values in: [NSApplication.appearance](https://developer.apple.com/documentation/appkit/nsapplication/2967170-appearance?language=objc). Setting this will override the
system default as well as the value of `getEffectiveAppearance`.
@ -463,7 +463,7 @@ This property is only available on macOS 10.14 Mojave or newer.
### `systemPreferences.effectiveAppearance` _macOS_ _Readonly_
A `String` property that can be `dark`, `light` or `unknown`.
A `string` property that can be `dark`, `light` or `unknown`.
Returns the macOS appearance setting that is currently applied to your application,
maps to [NSApplication.effectiveAppearance](https://developer.apple.com/documentation/appkit/nsapplication/2967171-effectiveappearance?language=objc)