mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2024-11-02 09:09:35 +01:00
send notification when page is focused
Previous code was somewhat bugged
This commit is contained in:
parent
f799856df1
commit
dbcce81922
@ -32,13 +32,6 @@ var listening = document.getElementById("listening");
|
||||
var actions = document.getElementById("actions");
|
||||
var accounts = document.getElementById("accounts-list");
|
||||
var listenVisible = false;
|
||||
var pageBlur = false;
|
||||
document.addEventListener("focus", () => {
|
||||
pageBlur = false;
|
||||
});
|
||||
document.addEventListener("blur", () => {
|
||||
pageBlur = true;
|
||||
});
|
||||
|
||||
// Util
|
||||
isMojang = it => !!it.clientToken;
|
||||
@ -319,7 +312,7 @@ function handleSWMsg(event) {
|
||||
callback(data.action);
|
||||
}
|
||||
function authNotification(msg, yes, no) {
|
||||
if (!navigator.serviceWorker || (!pageBlur && !document.hidden) || Notification.permission != "granted") {
|
||||
if (!navigator.serviceWorker || Notification.permission != "granted") {
|
||||
if (confirm(msg)) yes(); else no();
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user