diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-10 10:13:34 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-16 21:01:19 +0300 |
commit | c559bcca03a83db3e6ce66d4ae3cd98f8b9d1cb0 (patch) | |
tree | c0b88650027f5d2091baba92007f86605dee9817 /app/assets/javascripts/smart_interval.js | |
parent | aeaf6686df0dabd211221b1158586136707f3bdf (diff) |
Prettify additional modules (I through Z)
Diffstat (limited to 'app/assets/javascripts/smart_interval.js')
-rw-r--r-- | app/assets/javascripts/smart_interval.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/app/assets/javascripts/smart_interval.js b/app/assets/javascripts/smart_interval.js index 5e385400747..8ca590123ae 100644 --- a/app/assets/javascripts/smart_interval.js +++ b/app/assets/javascripts/smart_interval.js @@ -93,7 +93,9 @@ export default class SmartInterval { destroy() { this.cancel(); document.removeEventListener('visibilitychange', this.handleVisibilityChange); - $(document).off('visibilitychange').off('beforeunload'); + $(document) + .off('visibilitychange') + .off('beforeunload'); } /* private */ @@ -111,11 +113,12 @@ export default class SmartInterval { triggerCallback() { this.isLoading = true; - this.cfg.callback() + this.cfg + .callback() .then(() => { this.isLoading = false; }) - .catch((err) => { + .catch(err => { this.isLoading = false; throw err; }); @@ -134,9 +137,9 @@ export default class SmartInterval { handleVisibilityChange(e) { this.state.pageVisibility = e.target.visibilityState; - const intervalAction = this.isPageVisible() ? - this.onVisibilityVisible : - this.onVisibilityHidden; + const intervalAction = this.isPageVisible() + ? this.onVisibilityVisible + : this.onVisibilityHidden; intervalAction.apply(this); } @@ -162,7 +165,9 @@ export default class SmartInterval { this.setCurrentInterval(nextInterval); } - isPageVisible() { return this.state.pageVisibility === 'visible'; } + isPageVisible() { + return this.state.pageVisibility === 'visible'; + } stopTimer() { const { state } = this; @@ -170,4 +175,3 @@ export default class SmartInterval { state.intervalId = window.clearInterval(state.intervalId); } } - |