From 0fe8df550d95926aca1607e6f9ef7ac8cb929adf Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 10 Sep 2022 18:34:37 +0200 Subject: notifications --- client-web/source/helper.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'client-web/source/helper.ts') diff --git a/client-web/source/helper.ts b/client-web/source/helper.ts index 35be473..4075a0f 100644 --- a/client-web/source/helper.ts +++ b/client-web/source/helper.ts @@ -64,3 +64,12 @@ export function image_view(url: string, opts?: Opts): HTMLElement { }) return img } + +export function notify(body: string, author?: string) { + if (document.hasFocus()) return + if (Notification.permission != "granted") return + if (author) + new Notification(`keks-meet: ${author}`, { body }) + else + new Notification(`keks-meet`, { body }) +} -- cgit v1.2.3-70-g09d2