mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-12-02 21:00:02 -05:00
only show push notification if window is not focussed
This commit is contained in:
parent
5a522dbd6f
commit
70bf316aeb
1 changed files with 11 additions and 8 deletions
|
|
@ -1404,14 +1404,17 @@
|
|||
|
||||
}
|
||||
|
||||
// show notification for new messages when using electron
|
||||
Notification.requestPermission().then((result) => {
|
||||
if(result === "granted"){
|
||||
new window.Notification("New Message", {
|
||||
body: "Someone sent you a message.",
|
||||
});
|
||||
}
|
||||
});
|
||||
// show notification for new messages if window is not focussed
|
||||
if(!document.hasFocus()){
|
||||
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 notification at a time
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// auto scroll to bottom if we want to
|
||||
if(this.autoScrollOnNewMessage){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue