summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/smart_interval.js
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-10-26 00:45:03 +0000
committerMike Greiling <mike@pixelcog.com>2018-10-26 00:45:03 +0000
commit0efbc126d080892214d312a3ae2549f1fc341cb6 (patch)
treeb7131288bcbc3c5b0160ad55ed4b95523ce71c12 /app/assets/javascripts/smart_interval.js
parent46e3ad4b948dedf67245708493ee17c4429f8bf3 (diff)
parent679c0048a8f679aad456c02e30486150bbd0d93d (diff)
downloadgitlab-ce-0efbc126d080892214d312a3ae2549f1fc341cb6.tar.gz
Merge branch 'master' into 'prettify-all-the-things-4'prettify-all-the-things-4
# Conflicts: # app/assets/javascripts/sidebar/components/time_tracking/collapsed_state.vue
Diffstat (limited to 'app/assets/javascripts/smart_interval.js')
-rw-r--r--app/assets/javascripts/smart_interval.js20
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);
}
}
-