diff options
author | Regis <boudinot.regis@yahoo.com> | 2016-12-29 10:14:11 -0700 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2016-12-29 10:14:11 -0700 |
commit | 49aecb6067cded1fc263a8fb825d939486e83575 (patch) | |
tree | d1d8542266a1987064e07bbe3324da078cbd940b | |
parent | 30e7952a442d16c18dd8430e02cabb2731e75ab6 (diff) | |
download | gitlab-ce-49aecb6067cded1fc263a8fb825d939486e83575.tar.gz |
properly remove events and get rid of lingering interval loops
-rw-r--r-- | app/assets/javascripts/vue_pipelines_index/store.js.es6 | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/app/assets/javascripts/vue_pipelines_index/store.js.es6 b/app/assets/javascripts/vue_pipelines_index/store.js.es6 index 04fde27af58..d7ae9255e9a 100644 --- a/app/assets/javascripts/vue_pipelines_index/store.js.es6 +++ b/app/assets/javascripts/vue_pipelines_index/store.js.es6 @@ -49,28 +49,20 @@ startTimeLoops(); - const removeTimeIntervals = () => { - clearInterval(this.timeLoopInterval); - }; - - const startIntervalLoops = () => { - startTimeLoops(); - }; + const removeTimeIntervals = () => clearInterval(this.timeLoopInterval); + const startIntervalLoops = () => startTimeLoops(); const removeAll = () => { + removeTimeIntervals(); window.removeEventListener('beforeunload', removeTimeIntervals); window.removeEventListener('focus', startIntervalLoops); window.removeEventListener('blur', removeTimeIntervals); - - // turbolinks event handler - document.removeEventListener('page:fetch', () => {}); + document.removeEventListener('page:fetch', removeAll); }; window.addEventListener('beforeunload', removeTimeIntervals); window.addEventListener('focus', startIntervalLoops); window.addEventListener('blur', removeTimeIntervals); - - // turbolinks event handler document.addEventListener('page:fetch', removeAll); } }; |