From 41e74860d8abc8e33648471249b127dd3f60fb88 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Wed, 12 Aug 2015 11:02:47 -0700 Subject: Cosmetic refactoring of the notifyMe function in utils.jsx and removed unnecessary files --- web/react/utils/utils.jsx | 48 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'web/react/utils/utils.jsx') diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 2136accb4..2a4cbaa62 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -97,31 +97,31 @@ module.exports.getCookie = function(name) { } module.exports.notifyMe = function(title, body, channel) { - if ("Notification" in window && Notification.permission !== 'denied') { - Notification.requestPermission(function (permission) { - if (Notification.permission !== permission) { - Notification.permission = permission; - } + if ('Notification' in window && Notification.permission !== 'denied') { + Notification.requestPermission(function(permission) { + if (Notification.permission !== permission) { + Notification.permission = permission; + } - if (permission === "granted") { - var notification = new Notification(title, - { body: body, tag: body, icon: '/static/images/icon50x50.gif' } - ); - notification.onclick = function() { - window.focus(); - if (channel) { - module.exports.switchChannel(channel); - } else { - window.location.href = "/"; - } - }; - setTimeout(function(){ - notification.close(); - }, 5000); - } - }); - } -} + if (permission === 'granted') { + var notification = new Notification(title, + {body: body, tag: body, icon: '/static/images/icon50x50.gif'} + ); + notification.onclick = function() { + window.focus(); + if (channel) { + module.exports.switchChannel(channel); + } else { + window.location.href = '/'; + } + }; + setTimeout(function() { + notification.close(); + }, 5000); + } + }); + } +}; module.exports.ding = function() { var audio = new Audio('/static/images/ding.mp3'); -- cgit v1.2.3-1-g7c22