Skip to content

Commit

Permalink
feat: add useMessage hook
Browse files Browse the repository at this point in the history
  • Loading branch information
keiko233 committed Feb 29, 2024
1 parent cf61d23 commit 1da9951
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/hooks/use-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
requestPermission,
sendNotification,
} from "@tauri-apps/api/notification";
import { MessageDialogOptions, message } from "@tauri-apps/api/dialog";

let permissionGranted: boolean | null = null;
let portable: boolean | null = null;

Expand Down Expand Up @@ -57,3 +59,10 @@ export const useNotification = async ({
if (body) options.body = body;
sendNotification(options);
};

export const useMessage = async (
value: string,
options?: string | MessageDialogOptions | undefined,
) => {
await message(value, options);
};

0 comments on commit 1da9951

Please sign in to comment.