Send toast notifications (brief auto-expiring OS window element) to your user. Can also be used with the Notification Web API.
This package is also accessible with window.__TAURI__.notification
when tauri.conf.json > build > withGlobalTauri
is set to true.
The APIs must be allowlisted on tauri.conf.json
:
{
"tauri": {
"allowlist": {
"notification": {
"all": true // enable all notification APIs
}
}
}
}
It is recommended to allowlist only the APIs you use for optimal bundle size and security.
#
Interfaces#
Type aliases#
PermissionƬ Permission: "granted"
| "denied"
| "default"
Possible permission values.
#
Defined in#
Functions#
isPermissionGranted▸ isPermissionGranted(): Promise
<boolean
| null
>
Checks if the permission to send notifications is granted.
#
ReturnsPromise
<boolean
| null
>
#
Defined in#
requestPermission▸ requestPermission(): Promise
<Permission
>
Requests the permission to send notifications.
#
ReturnsPromise
<Permission
>
A promise resolving to whether the user granted the permission or not.
#
Defined in#
sendNotification▸ sendNotification(options
): void
Sends a notification to the user.
#
ParametersName | Type | Description |
---|---|---|
options | Options | string | Notification options. |
#
Returnsvoid