|
|
@ -296,7 +296,7 @@ type Permission = "granted" | "denied" | "default";
|
|
|
|
* Checks if the permission to send notifications is granted.
|
|
|
|
* Checks if the permission to send notifications is granted.
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { isPermissionGranted } from '@tauri-apps/api/notification';
|
|
|
|
* import { isPermissionGranted } from '@tauri-apps/plugin-notification';
|
|
|
|
* const permissionGranted = await isPermissionGranted();
|
|
|
|
* const permissionGranted = await isPermissionGranted();
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -313,7 +313,7 @@ async function isPermissionGranted(): Promise<boolean> {
|
|
|
|
* Requests the permission to send notifications.
|
|
|
|
* Requests the permission to send notifications.
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { isPermissionGranted, requestPermission } from '@tauri-apps/api/notification';
|
|
|
|
* import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification';
|
|
|
|
* let permissionGranted = await isPermissionGranted();
|
|
|
|
* let permissionGranted = await isPermissionGranted();
|
|
|
|
* if (!permissionGranted) {
|
|
|
|
* if (!permissionGranted) {
|
|
|
|
* const permission = await requestPermission();
|
|
|
|
* const permission = await requestPermission();
|
|
|
@ -333,7 +333,7 @@ async function requestPermission(): Promise<Permission> {
|
|
|
|
* Sends a notification to the user.
|
|
|
|
* Sends a notification to the user.
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { isPermissionGranted, requestPermission, sendNotification } from '@tauri-apps/api/notification';
|
|
|
|
* import { isPermissionGranted, requestPermission, sendNotification } from '@tauri-apps/plugin-notification';
|
|
|
|
* let permissionGranted = await isPermissionGranted();
|
|
|
|
* let permissionGranted = await isPermissionGranted();
|
|
|
|
* if (!permissionGranted) {
|
|
|
|
* if (!permissionGranted) {
|
|
|
|
* const permission = await requestPermission();
|
|
|
|
* const permission = await requestPermission();
|
|
|
@ -362,7 +362,7 @@ function sendNotification(options: Options | string): void {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { registerActionTypes } from '@tauri-apps/api/notification';
|
|
|
|
* import { registerActionTypes } from '@tauri-apps/plugin-notification';
|
|
|
|
* await registerActionTypes([{
|
|
|
|
* await registerActionTypes([{
|
|
|
|
* id: 'tauri',
|
|
|
|
* id: 'tauri',
|
|
|
|
* actions: [{
|
|
|
|
* actions: [{
|
|
|
@ -385,7 +385,7 @@ async function registerActionTypes(types: ActionType[]): Promise<void> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { pending } from '@tauri-apps/api/notification';
|
|
|
|
* import { pending } from '@tauri-apps/plugin-notification';
|
|
|
|
* const pendingNotifications = await pending();
|
|
|
|
* const pendingNotifications = await pending();
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -402,7 +402,7 @@ async function pending(): Promise<PendingNotification[]> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { cancel } from '@tauri-apps/api/notification';
|
|
|
|
* import { cancel } from '@tauri-apps/plugin-notification';
|
|
|
|
* await cancel([-34234, 23432, 4311]);
|
|
|
|
* await cancel([-34234, 23432, 4311]);
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -419,7 +419,7 @@ async function cancel(notifications: number[]): Promise<void> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { cancelAll } from '@tauri-apps/api/notification';
|
|
|
|
* import { cancelAll } from '@tauri-apps/plugin-notification';
|
|
|
|
* await cancelAll();
|
|
|
|
* await cancelAll();
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -436,7 +436,7 @@ async function cancelAll(): Promise<void> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { active } from '@tauri-apps/api/notification';
|
|
|
|
* import { active } from '@tauri-apps/plugin-notification';
|
|
|
|
* const activeNotifications = await active();
|
|
|
|
* const activeNotifications = await active();
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -453,7 +453,7 @@ async function active(): Promise<ActiveNotification[]> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { cancel } from '@tauri-apps/api/notification';
|
|
|
|
* import { cancel } from '@tauri-apps/plugin-notification';
|
|
|
|
* await cancel([-34234, 23432, 4311])
|
|
|
|
* await cancel([-34234, 23432, 4311])
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -470,7 +470,7 @@ async function removeActive(notifications: number[]): Promise<void> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { removeAllActive } from '@tauri-apps/api/notification';
|
|
|
|
* import { removeAllActive } from '@tauri-apps/plugin-notification';
|
|
|
|
* await removeAllActive()
|
|
|
|
* await removeAllActive()
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -487,7 +487,7 @@ async function removeAllActive(): Promise<void> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { createChannel, Importance, Visibility } from '@tauri-apps/api/notification';
|
|
|
|
* import { createChannel, Importance, Visibility } from '@tauri-apps/plugin-notification';
|
|
|
|
* await createChannel({
|
|
|
|
* await createChannel({
|
|
|
|
* id: 'new-messages',
|
|
|
|
* id: 'new-messages',
|
|
|
|
* name: 'New Messages',
|
|
|
|
* name: 'New Messages',
|
|
|
@ -511,7 +511,7 @@ async function createChannel(channel: Channel): Promise<void> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { removeChannel } from '@tauri-apps/api/notification';
|
|
|
|
* import { removeChannel } from '@tauri-apps/plugin-notification';
|
|
|
|
* await removeChannel();
|
|
|
|
* await removeChannel();
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -528,7 +528,7 @@ async function removeChannel(id: string): Promise<void> {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
* @example
|
|
|
|
* ```typescript
|
|
|
|
* ```typescript
|
|
|
|
* import { channels } from '@tauri-apps/api/notification';
|
|
|
|
* import { channels } from '@tauri-apps/plugin-notification';
|
|
|
|
* const notificationChannels = await channels();
|
|
|
|
* const notificationChannels = await channels();
|
|
|
|
* ```
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*
|
|
|
|