mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
perf(animations): do not create setTimeout if infinite iterations (#19632)
closes #19627
This commit is contained in:
@ -819,7 +819,10 @@ export const createAnimation = (): Animation => {
|
||||
const animationDuration = getDuration() || 0;
|
||||
const animationIterations = getIterations() || 1;
|
||||
|
||||
cssAnimationsTimerFallback = setTimeout(onAnimationEndFallback, animationDelay + (animationDuration * animationIterations) + ANIMATION_END_FALLBACK_PADDING_MS);
|
||||
// No need to set a timeout when animation has infinite iterations
|
||||
if (isFinite(animationIterations)) {
|
||||
cssAnimationsTimerFallback = setTimeout(onAnimationEndFallback, animationDelay + (animationDuration * animationIterations) + ANIMATION_END_FALLBACK_PADDING_MS);
|
||||
}
|
||||
|
||||
animationEnd(elements[0], () => {
|
||||
clearCSSAnimationsTimeout();
|
||||
|
Reference in New Issue
Block a user