fix(scroll): clearInterval just to be safe

This commit is contained in:
Manu Mtz.-Almeida
2018-03-02 18:44:33 +01:00
parent 33a6274613
commit 6da9882c6c

View File

@@ -85,6 +85,12 @@ export class Scroll {
}
}
componentDidUnload() {
if (this.watchDog) {
clearInterval(this.watchDog);
}
}
@Listen('scroll', { passive: true })
onScroll(ev: UIEvent) {
const timeStamp = Date.now();
@@ -220,6 +226,9 @@ export class Scroll {
isScrolling: true
});
if (this.watchDog) {
clearInterval(this.watchDog);
}
// watchdog
this.watchDog = setInterval(() => {
if (this.lastScroll < Date.now() - 120) {