Skip to content

Commit

Permalink
feat: Clear timer when component is uninstalled
Browse files Browse the repository at this point in the history
  • Loading branch information
黄斌 committed Jul 2, 2020
1 parent 15692c3 commit f33df44
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CSSMotion.js
Expand Up @@ -119,6 +119,7 @@ export function genCSSMotion(config) {
this._destroyed = true;
this.removeEventListener(this.$cacheEle);
this.cancelNextFrame();
clearTimeout(this.timer);
}

onDomUpdate = () => {
Expand Down Expand Up @@ -247,7 +248,7 @@ export function genCSSMotion(config) {
this.updateStatus(styleFunc, { statusActive: true });

if (motionDeadline > 0) {
setTimeout(() => {
this.timer = setTimeout(() => {
this.onMotionEnd({
deadline: true,
});
Expand Down

0 comments on commit f33df44

Please sign in to comment.