pull/840/head
Thibault Duplessis 2015-08-25 12:59:08 +02:00
parent 1181dd3e76
commit 923fc872af
1 changed files with 14 additions and 10 deletions

View File

@ -326,16 +326,20 @@ window.addEventListener('blur', function() {
lichess.isPageVisible = false;
});
lichess.desktopNotification = function(msg) {
if (lichess.isPageVisible || !("Notification" in window) || Notification.permission === "denied") return;
if (Notification.permission === "granted") {
var notification = new Notification("lichess", {body: msg});
} else {
Notification.requestPermission(function (permission) {
if (permission === "granted") {
var notification = new Notification("lichess", {body: msg});
}
});
}
if (lichess.isPageVisible || !("Notification" in window) || Notification.permission === "denied") return;
if (Notification.permission === "granted") {
var notification = new Notification("lichess", {
body: msg
});
} else {
Notification.requestPermission(function(permission) {
if (permission === "granted") {
var notification = new Notification("lichess", {
body: msg
});
}
});
}
};
(function() {