diff --git a/client/dcwebui.js b/client/dcwebui.js index ae85a30..b33a19e 100644 --- a/client/dcwebui.js +++ b/client/dcwebui.js @@ -151,16 +151,22 @@ var notify = function(title, body) { return; // not supported by browser } - if (window.Notification.permission === "granted") { - var nn = new Notification(title, { - body: body, - icon: DCWEBUI_CONF.extern + "/favicon.ico" - }); + switch (window.Notification.permission) { + case "granted": { + new Notification(title, { + body: body, + icon: DCWEBUI_CONF.extern + "/favicon.ico" + }); + } break; - } else if (window.Notification.permission !== "denied") { - Notification.requestPermission(function(permission) { - notify(title, body); - }); + case "denied": return; + + default: { + // Clarify permission and retry + Notification.requestPermission(function(permission) { + notify(title, body); + }); + } break; } };