diff options
Diffstat (limited to 'client-web/source/chat.ts')
-rw-r--r-- | client-web/source/chat.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/client-web/source/chat.ts b/client-web/source/chat.ts index 792a620..e08437b 100644 --- a/client-web/source/chat.ts +++ b/client-web/source/chat.ts @@ -59,5 +59,15 @@ export class Chat extends OverlayUi { this.messages.append(ediv({ class: "message" }, espan(sender.display_name, { class: "author" }), ": ", ...els )) + this.shown = true + this.notify(sender, message) + } + notify(sender: User, message: ChatMessage) { + if (sender.local || document.hasFocus()) return + if (Notification.permission != "granted") return + let body = "(empty message)" + if (message.text) body = message.text + if (message.image) body = "(image)" + new Notification(`keks-meet: ${sender.display_name}`, { body }) } } |