diff --git a/js/beestat/api.js b/js/beestat/api.js index a2fb98d..104995b 100644 --- a/js/beestat/api.js +++ b/js/beestat/api.js @@ -75,7 +75,7 @@ beestat.api.prototype.send = function(opt_api_call) { * problems. */ if (this.callback_ !== undefined) { - setTimeout(function() { + window.setTimeout(function() { self.callback_(self.cached_batch_api_calls_); }, 0); } @@ -94,7 +94,7 @@ beestat.api.prototype.send = function(opt_api_call) { * callback, the rerender can happen during a render which causes * problems. */ - setTimeout(function() { + window.setTimeout(function() { self.callback_(cached.data); }, 0); } diff --git a/js/beestat/debounce.js b/js/beestat/debounce.js index 89275a8..f13a7e5 100644 --- a/js/beestat/debounce.js +++ b/js/beestat/debounce.js @@ -24,8 +24,8 @@ beestat.debounce = function(func, wait, immediate) { } }; var callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); + window.clearTimeout(timeout); + timeout = window.setTimeout(later, wait); if (callNow) { func.apply(self, args); } diff --git a/js/component.js b/js/component.js index 050f97f..780dd51 100644 --- a/js/component.js +++ b/js/component.js @@ -39,7 +39,7 @@ beestat.component.prototype.render = function(parent) { } // The element should now exist on the DOM. - setTimeout(function() { + window.setTimeout(function() { self.dispatchEvent('render'); }, 0); @@ -67,7 +67,7 @@ beestat.component.prototype.rerender = function() { this.component_container_ = new_container; var self = this; - setTimeout(function() { + window.setTimeout(function() { self.dispatchEvent('render'); }, 0); } diff --git a/js/component/alert.js b/js/component/alert.js index 37eb0f3..2d46540 100644 --- a/js/component/alert.js +++ b/js/component/alert.js @@ -357,7 +357,7 @@ beestat.component.alert.prototype.show = function() { 'padding-bottom': (beestat.style.size.gutter / 2) }); - setTimeout(function() { + window.setTimeout(function() { self.alert_main_.style('height', 'auto'); }, 200); } @@ -398,7 +398,7 @@ beestat.component.alert.prototype.hide = function() { this.height_ = this.alert_main_.getBoundingClientRect().height; this.alert_main_.style('height', this.height_); - setTimeout(function() { + window.setTimeout(function() { self.alert_main_.style({ 'height': '0', 'padding-top': '0', diff --git a/js/component/card/patreon.js b/js/component/card/patreon.js index b6c7cab..163d6a2 100644 --- a/js/component/card/patreon.js +++ b/js/component/card/patreon.js @@ -20,7 +20,7 @@ beestat.component.card.patreon.prototype.decorate_contents_ = function(parent) { // Don't render anything if the user is an active Patron. if (beestat.component.card.patreon.should_show() === false) { - setTimeout(function() { + window.setTimeout(function() { self.dispose(); }, 0); return; diff --git a/js/component/card/runtime_sensor_detail.js b/js/component/card/runtime_sensor_detail.js index 2825ca3..08ce90b 100644 --- a/js/component/card/runtime_sensor_detail.js +++ b/js/component/card/runtime_sensor_detail.js @@ -220,7 +220,7 @@ beestat.component.card.runtime_sensor_detail.prototype.decorate_contents_ = func } } else { this.show_loading_('Syncing'); - setTimeout(function() { + window.setTimeout(function() { new beestat.api() .add_call( 'thermostat', diff --git a/js/component/card/runtime_thermostat_detail.js b/js/component/card/runtime_thermostat_detail.js index 87d4e61..20003b3 100644 --- a/js/component/card/runtime_thermostat_detail.js +++ b/js/component/card/runtime_thermostat_detail.js @@ -208,7 +208,7 @@ beestat.component.card.runtime_thermostat_detail.prototype.decorate_contents_ = } } else { this.show_loading_('Syncing'); - setTimeout(function() { + window.setTimeout(function() { new beestat.api() .add_call( 'thermostat', diff --git a/js/component/card/runtime_thermostat_summary.js b/js/component/card/runtime_thermostat_summary.js index e523df4..7e8389f 100755 --- a/js/component/card/runtime_thermostat_summary.js +++ b/js/component/card/runtime_thermostat_summary.js @@ -99,7 +99,7 @@ beestat.component.card.runtime_thermostat_summary.prototype.decorate_contents_ = } this.show_loading_('Syncing (' + sync_progress + '%)
' + string_remain + ' remaining'); - setTimeout(function() { + window.setTimeout(function() { var api = new beestat.api(); api.add_call( 'runtime_thermostat_summary', diff --git a/js/component/chart.js b/js/component/chart.js index bed1c5a..c2de07d 100644 --- a/js/component/chart.js +++ b/js/component/chart.js @@ -120,7 +120,7 @@ beestat.component.chart.prototype.get_options_plotOptions_ = function() { 'events': { 'legendItemClick': function() { // Delay the event dispatch so the series is actually toggled to the correct visibility. - setTimeout(function() { + window.setTimeout(function() { self.dispatchEvent('legend_item_click'); }, 0); } diff --git a/js/component/menu.js b/js/component/menu.js index 9b5b0fa..644f0d8 100644 --- a/js/component/menu.js +++ b/js/component/menu.js @@ -47,7 +47,7 @@ beestat.component.menu.prototype.dispose = function() { container.style('transform', 'scale(0)'); delete beestat.component.menu.open_menu; - setTimeout(function() { + window.setTimeout(function() { self.menu_items_.forEach(function(menu_item) { menu_item.dispose(); }); @@ -94,7 +94,7 @@ beestat.component.menu.prototype.open_ = function() { }); // Transition the element in after it's been placed on the page. - setTimeout(function() { + window.setTimeout(function() { container.style('transform', 'scale(1)'); /* diff --git a/js/component/modal.js b/js/component/modal.js index bb8e497..f155481 100644 --- a/js/component/modal.js +++ b/js/component/modal.js @@ -74,7 +74,7 @@ beestat.component.modal.prototype.decorate_ = function() { * Fade in the mask * Overpop the modal */ - setTimeout(function() { + window.setTimeout(function() { $('body').firstElementChild() .style('filter', 'blur(3px)'); mask.style('background', 'rgba(0, 0, 0, 0.5)'); @@ -82,7 +82,7 @@ beestat.component.modal.prototype.decorate_ = function() { }, 0); // Pop the modal back to normal size - setTimeout(function() { + window.setTimeout(function() { modal.style('transform', 'translateX(-50%) scale(1)'); }, 200); @@ -117,7 +117,7 @@ beestat.component.modal.prototype.dispose = function() { $('body').firstElementChild() .style('filter', ''); - setTimeout(function() { + window.setTimeout(function() { self.modal_.parentNode().removeChild(self.modal_); self.mask_.parentNode().removeChild(self.mask_); diff --git a/js/component/modal/patreon_status.js b/js/component/modal/patreon_status.js index ecb3233..8bbeced 100644 --- a/js/component/modal/patreon_status.js +++ b/js/component/modal/patreon_status.js @@ -50,7 +50,7 @@ beestat.component.modal.patreon_status.prototype.decorate_wait_ = function(paren self.rerender(); }); - setTimeout(function() { + window.setTimeout(function() { api.send(); }, 5000); };