mirror of
https://github.com/lumehq/lume.git
synced 2025-09-19 05:40:40 +02:00
added sendNativeNotification
This commit is contained in:
12
src/utils/notification.tsx
Normal file
12
src/utils/notification.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { isPermissionGranted, requestPermission, sendNotification } from '@tauri-apps/api/notification';
|
||||
|
||||
export async function sendNativeNotification(content: string) {
|
||||
let permissionGranted = await isPermissionGranted();
|
||||
if (!permissionGranted) {
|
||||
const permission = await requestPermission();
|
||||
permissionGranted = permission === 'granted';
|
||||
}
|
||||
if (permissionGranted) {
|
||||
sendNotification({ title: 'TAURI', body: content });
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user