Skip to content

Commit cadb15d

Browse files
binyellow黄斌
and
黄斌
authored
feat: Clear timer when component is uninstalled (#108)
Co-authored-by: 黄斌 <[email protected]>
1 parent 15692c3 commit cadb15d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/CSSMotion.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export function genCSSMotion(config) {
119119
this._destroyed = true;
120120
this.removeEventListener(this.$cacheEle);
121121
this.cancelNextFrame();
122+
clearTimeout(this.timer);
122123
}
123124

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

249250
if (motionDeadline > 0) {
250-
setTimeout(() => {
251+
this.timer = setTimeout(() => {
251252
this.onMotionEnd({
252253
deadline: true,
253254
});

0 commit comments

Comments
 (0)