Skip to content

Commit

Permalink
fix(scroll): clearInterval just to be safe
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Mar 2, 2018
1 parent 33a6274 commit 6da9882
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/components/scroll/scroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 6da9882

Please sign in to comment.