diff --git a/amadeus/static/js/socket.js b/amadeus/static/js/socket.js index 9395c7c..42f0f99 100644 --- a/amadeus/static/js/socket.js +++ b/amadeus/static/js/socket.js @@ -1,3 +1,10 @@ +if (("Notification" in window)) { + if (Notification.permission !== 'denied') { + Notification.requestPermission(); + } +} + + socket = new WebSocket("ws://" + window.location.host + "/"); socket.onmessage = function(e) { @@ -20,16 +27,7 @@ socket.onmessage = function(e) { var notification = new Notification("", options); setTimeout(notification.close.bind(notification), 3000); - } else if (Notification.permission !== 'denied') { - Notification.requestPermission(function (permission) { - // If the user accepts, let's create a notification - if (permission === "granted") { - var notification = new Notification("", options); - - setTimeout(notification.close.bind(notification), 3000); - } - }); - } + } } } } -- libgit2 0.21.2