@tauri-apps/plugin-notification
此内容尚不支持你的语言。
Send toast notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
Enumerations
Importance
Enumeration Members
Default
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L287
High
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L288
Low
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L286
Min
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L285
None
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L284
ScheduleEvery
Enumeration Members
Day
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L159
Hour
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L160
Minute
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L161
Month
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L156
Second
Not supported on iOS.
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L165
TwoWeeks
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L157
Week
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L158
Year
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L155
Visibility
Enumeration Members
Private
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L293
Public
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L294
Secret
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L292
Classes
Schedule
Constructors
new Schedule()
Returns
Properties
Property | Type | Defined in |
---|---|---|
at | undefined | object | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L169 |
every | undefined | object | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L184 |
interval | undefined | object | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L177 |
Methods
at()
Parameters
Parameter | Type | Default value |
---|---|---|
date | Date | undefined |
repeating | boolean | false |
allowWhileIdle | boolean | false |
Returns
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L192
every()
Parameters
Parameter | Type | Default value |
---|---|---|
kind | ScheduleEvery | undefined |
count | number | undefined |
allowWhileIdle | boolean | false |
Returns
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L211
interval()
Parameters
Parameter | Type | Default value |
---|---|---|
interval | ScheduleInterval | undefined |
allowWhileIdle | boolean | false |
Returns
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L200
Interfaces
Action
Properties
ActionType
Properties
ActiveNotification
Properties
Attachment
Attachment of a notification.
Properties
Property | Type | Description | Defined in |
---|---|---|---|
id | string | Attachment identifier. | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L229 |
url | string | Attachment URL. Accepts the asset and file protocols. | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L231 |
Channel
Properties
Options
Options to send a notification.
Since
2.0.0
Properties
PendingNotification
Properties
ScheduleInterval
Properties
Property | Type | Description | Defined in |
---|---|---|---|
day? | number | - | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L138 |
hour? | number | - | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L149 |
minute? | number | - | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L150 |
month? | number | - | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L137 |
second? | number | - | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L151 |
weekday? | number | 1 - Sunday 2 - Monday 3 - Tuesday 4 - Wednesday 5 - Thursday 6 - Friday 7 - Saturday | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L148 |
year? | number | - | Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L136 |
Type Aliases
PermissionState
Source: undefined
Functions
active()
Retrieves the list of active notifications.
Returns
A promise resolving to the list of active notifications.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L459
cancel()
Cancels the pending notifications with the given list of identifiers.
Parameters
Parameter | Type |
---|---|
notifications | number [] |
Returns
Promise
<void
>
A promise indicating the success or failure of the operation.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L425
cancelAll()
Cancels all pending notifications.
Returns
Promise
<void
>
A promise indicating the success or failure of the operation.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L442
channels()
Retrieves the list of notification channels.
Returns
A promise resolving to the list of notification channels.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L553
createChannel()
Creates a notification channel.
Parameters
Parameter | Type |
---|---|
channel | Channel |
Returns
Promise
<void
>
A promise indicating the success or failure of the operation.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L519
isPermissionGranted()
Checks if the permission to send notifications is granted.
Returns
Promise
<boolean
>
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L319
onAction()
Parameters
Parameter | Type |
---|---|
cb | (notification ) => void |
Returns
Promise
<PluginListener
>
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L563
onNotificationReceived()
Parameters
Parameter | Type |
---|---|
cb | (notification ) => void |
Returns
Promise
<PluginListener
>
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L557
pending()
Retrieves the list of pending notifications.
Returns
Promise
<PendingNotification
[]>
A promise resolving to the list of pending notifications.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L408
registerActionTypes()
Register actions that are performed when the user clicks on the notification.
Parameters
Parameter | Type |
---|---|
types | ActionType [] |
Returns
Promise
<void
>
A promise indicating the success or failure of the operation.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L391
removeActive()
Removes the active notifications with the given list of identifiers.
Parameters
Parameter | Type |
---|---|
notifications | object [] |
Returns
Promise
<void
>
A promise indicating the success or failure of the operation.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L476
removeAllActive()
Removes all active notifications.
Returns
Promise
<void
>
A promise indicating the success or failure of the operation.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L495
removeChannel()
Removes the channel with the given identifier.
Parameters
Parameter | Type |
---|---|
id | string |
Returns
Promise
<void
>
A promise indicating the success or failure of the operation.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L536
requestPermission()
Requests the permission to send notifications.
Returns
Promise
<NotificationPermission
>
A promise resolving to whether the user granted the permission or not.
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L342
sendNotification()
Sends a notification to the user.
Parameters
Parameter | Type |
---|---|
options | string | Options |
Returns
void
Example
Since
2.0.0
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/notification/guest-js/index.ts#L364
© 2024 Tauri Contributors. CC-BY / MIT