feat: custom toast xml and failure reporting for notifications (#25401)
* allow custom toast xml and report failures * docs * tests * don't use namespaces * lint doesn't like trailing commas * addressing feedback
This commit is contained in:
parent
d2282ac51a
commit
b43859f098
9 changed files with 282 additions and 219 deletions
|
@ -29,9 +29,9 @@ Returns `Boolean` - Whether or not desktop notifications are supported on the cu
|
|||
### `new Notification([options])`
|
||||
|
||||
* `options` Object (optional)
|
||||
* `title` String - A title for the notification, which will be shown at the top of the notification window when it is shown.
|
||||
* `title` String (optional) - A title for the notification, which will be shown at the top of the notification window when it is shown.
|
||||
* `subtitle` String (optional) _macOS_ - A subtitle for the notification, which will be displayed below the title.
|
||||
* `body` String - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
* `body` String (optional) - The body text of the notification, which will be displayed below the title or subtitle.
|
||||
* `silent` Boolean (optional) - Whether or not to emit an OS notification noise when showing the notification.
|
||||
* `icon` (String | [NativeImage](native-image.md)) (optional) - An icon to use in the notification.
|
||||
* `hasReply` Boolean (optional) _macOS_ - Whether or not to add an inline reply option to the notification.
|
||||
|
@ -41,6 +41,7 @@ Returns `Boolean` - Whether or not desktop notifications are supported on the cu
|
|||
* `urgency` String (optional) _Linux_ - The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
|
||||
* `actions` [NotificationAction[]](structures/notification-action.md) (optional) _macOS_ - Actions to add to the notification. Please read the available actions and limitations in the `NotificationAction` documentation.
|
||||
* `closeButtonText` String (optional) _macOS_ - A custom title for the close button of an alert. An empty string will cause the default localized text to be used.
|
||||
* `toastXml` String (optional) _Windows_ - A custom description of the Notification on Windows superseding all properties above. Provides full customization of design and behavior of the notification.
|
||||
|
||||
### Instance Events
|
||||
|
||||
|
@ -94,6 +95,15 @@ Returns:
|
|||
* `event` Event
|
||||
* `index` Number - The index of the action that was activated.
|
||||
|
||||
#### Event: 'failed' _Windows_
|
||||
|
||||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `error` String - The error encountered during execution of the `show()` method.
|
||||
|
||||
Emitted when an error is encountered while creating and showing the native notification.
|
||||
|
||||
### Instance Methods
|
||||
|
||||
Objects created with `new Notification` have the following instance methods:
|
||||
|
@ -162,6 +172,10 @@ If `timeoutType` is set to 'never', the notification never expires. It stays ope
|
|||
|
||||
A [`NotificationAction[]`](structures/notification-action.md) property representing the actions of the notification.
|
||||
|
||||
#### `notification.toastXml` _Windows_
|
||||
|
||||
A `String` property representing the custom Toast XML of the notification.
|
||||
|
||||
### Playing Sounds
|
||||
|
||||
On macOS, you can specify the name of the sound you'd like to play when the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue