simplify some of the code for notifications
This commit is contained in:
parent
1f754f53a3
commit
54f29398e2
10
js/chess.js
10
js/chess.js
|
|
@ -602,13 +602,11 @@ function disableNotify(){
|
|||
|
||||
function requestNotify(){
|
||||
try {
|
||||
if (Notification && Notification.permission !== 'granted') {
|
||||
Notification.requestPermission(function (permission){
|
||||
if (permission === 'denied') {
|
||||
disableNotify();
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
disableNotify();
|
||||
}
|
||||
|
|
@ -637,7 +635,9 @@ function notify(body) {
|
|||
|
||||
$(function (){
|
||||
try {
|
||||
if ('serviceWorker' in navigator) {
|
||||
if (Notification.permission === 'denied') {
|
||||
disableNotify();
|
||||
} else {
|
||||
navigator.serviceWorker.register('sw.js').catch(disableNotify);
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
@ -717,10 +717,6 @@ $(function (){
|
|||
}
|
||||
});
|
||||
|
||||
if (Notification.permission === 'denied') {
|
||||
disableNotify();
|
||||
}
|
||||
|
||||
let updateMeta = function() { putMeta(); }
|
||||
$('#cb_light_name').on('input', updateMeta);
|
||||
$('#cb_dark_name').on('input', updateMeta);
|
||||
|
|
|
|||
Loading…
Reference in New Issue