aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-11-29 12:01:36 +0100
committerMario Vavti <mario@mariovavti.com>2017-11-29 12:01:36 +0100
commitaa7f6111a69e8b25901b5e2c8f4c4828551316a9 (patch)
treeb865776582dc0d9a28a3b0a1059da07afdd69202 /view/js
parentb1f82257e80a2d015c7468ed62cdb2ba6668d6ea (diff)
downloadvolse-hubzilla-aa7f6111a69e8b25901b5e2c8f4c4828551316a9.tar.gz
volse-hubzilla-aa7f6111a69e8b25901b5e2c8f4c4828551316a9.tar.bz2
volse-hubzilla-aa7f6111a69e8b25901b5e2c8f4c4828551316a9.zip
use typeof if checking for undefined var and always clear timeout before setting a new one
Diffstat (limited to 'view/js')
-rw-r--r--view/js/main.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/view/js/main.js b/view/js/main.js
index c9bde8452..888934ea8 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -339,8 +339,8 @@ function closeMenu(theID) {
function markRead(notifType) {
$.get('ping?f=&markRead='+notifType);
- if(timer) clearTimeout(timer);
$('.' + notifType + '-button').hide();
+ if(timer) clearTimeout(timer);
timer = setTimeout(updateInit,2000);
}
@@ -412,7 +412,8 @@ function notificationsUpdate() {
$.jGrowl(this.message, { sticky: false, theme: 'info', life: 10000 });
});
})
- timer = setTimeout(updateInit, updateInterval);
+ if(timer) clearTimeout(timer);
+ timer = setTimeout(updateInit,updateInterval);
}
function contextualHelp() {
@@ -762,7 +763,7 @@ function liveUpdate(notify_id) {
// else data was valid - reset the recursion counter
liveRecurse = 0;
- if(notify_id !== 'undefined') {
+ if(typeof notify_id !== 'undefined') {
$.post(
"hq",
{