mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-12-04 05:40:02 -05:00
clean up notification code
This commit is contained in:
parent
870fc72f09
commit
4a92d44991
3 changed files with 31 additions and 16 deletions
27
src/frontend/js/NotificationUtils.js
Normal file
27
src/frontend/js/NotificationUtils.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
class NotificationUtils {
|
||||
|
||||
static showIncomingCallNotification() {
|
||||
Notification.requestPermission().then((result) => {
|
||||
if(result === "granted"){
|
||||
new window.Notification("Incoming Call", {
|
||||
body: "Someone is calling you.",
|
||||
tag: "new_audio_call", // only ever show one incoming call notification at a time
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static showNewMessageNotification() {
|
||||
Notification.requestPermission().then((result) => {
|
||||
if(result === "granted"){
|
||||
new window.Notification("New Message", {
|
||||
body: "Someone sent you a message.",
|
||||
tag: "new_message", // only ever show one new message notification at a time
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default NotificationUtils;
|
||||
Loading…
Add table
Add a link
Reference in a new issue