Rename enabled --> isEnabled

This commit is contained in:
Daniel Gasienica 2018-02-23 16:25:11 -05:00
parent 59bee6690d
commit 9516d667da

View file

@ -13,7 +13,7 @@
MESSAGE : 'message' MESSAGE : 'message'
}; };
var enabled = false; let isEnabled = false;
var sound = new Audio('audio/NewMessage.mp3'); var sound = new Audio('audio/NewMessage.mp3');
Whisper.Notifications = new (Backbone.Collection.extend({ Whisper.Notifications = new (Backbone.Collection.extend({
@ -30,10 +30,11 @@
console.log( console.log(
'updating notifications - count:', this.length, 'updating notifications - count:', this.length,
'focused:', isFocused, 'focused:', isFocused,
'enabled:', enabled 'isEnabled:', isEnabled
); );
if (!enabled) {
return; // wait til we are re-enabled if (!isEnabled) {
return;
} }
if (this.length === 0) { if (this.length === 0) {
return; return;
@ -122,14 +123,14 @@
this.reset([]); this.reset([]);
}, },
enable: function() { enable: function() {
var update = !enabled; var shouldUpdate = !isEnabled;
enabled = true; isEnabled = true;
if (update) { if (shouldUpdate) {
this.update(); this.update();
} }
}, },
disable: function() { disable: function() {
enabled = false; isEnabled = false;
}, },
}))(); }))();