Skip to content

Commit

Permalink
feat: Clear timer when component is uninstalled (#108)
Browse files Browse the repository at this point in the history
Co-authored-by: 黄斌 <huangbin@hupu.com>
  • Loading branch information
binyellow and 黄斌 authored Jul 2, 2020
1 parent 15692c3 commit cadb15d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/CSSMotion.js
Original file line number Diff line number Diff line change
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 cadb15d

Please sign in to comment.