Commit 18b559c9 authored by Regis's avatar Regis

deal with preventing DDOS

parent a96499cf
......@@ -43,7 +43,7 @@
resourceChecker();
goFetch();
const removePipelineInterval = () => {
const removePipelineIntervals = () => {
this.allTimeIntervals.forEach(e => clearInterval(e.id));
};
......@@ -51,17 +51,18 @@
this.allTimeIntervals.forEach(e => e.start());
};
window.onbeforeunload = function onClose() {
removePipelineInterval();
const removeAll = () => {
removePipelineIntervals();
window.removeEventListener('beforeunload', () => {});
window.removeEventListener('focus', () => {});
window.removeEventListener('blur', () => {});
document.removeEventListener('page:fetch', () => {});
};
window.onblur = function remove() {
removePipelineInterval();
};
window.onfocus = function start() {
startIntervalLoops();
};
window.addEventListener('beforeunload', removePipelineIntervals);
window.addEventListener('focus', startIntervalLoops);
window.addEventListener('blur', removePipelineIntervals);
document.addEventListener('page:fetch', removeAll);
}
};
})(window.gl || (window.gl = {}));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment