mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
feat(animation): add option to clean up old animation stylesheets (#20940)
fixes #20610
This commit is contained in:
@ -27,7 +27,7 @@ export interface Animation {
|
|||||||
/**
|
/**
|
||||||
* Destroy the animation and all child animations.
|
* Destroy the animation and all child animations.
|
||||||
*/
|
*/
|
||||||
destroy(): void;
|
destroy(clearStyleSheets?: boolean): void;
|
||||||
|
|
||||||
progressStart(forceLinearEasing: boolean, step?: number): void;
|
progressStart(forceLinearEasing: boolean, step?: number): void;
|
||||||
progressStep(step: number): void;
|
progressStep(step: number): void;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// TODO: Add more tests. until then, be sure to manually test menu and swipe to go back/routing transitions
|
|
||||||
|
|
||||||
import { raf } from '../helpers';
|
import { raf } from '../helpers';
|
||||||
|
|
||||||
import { Animation, AnimationCallbackOptions, AnimationDirection, AnimationFill, AnimationKeyFrame, AnimationKeyFrameEdge, AnimationKeyFrames, AnimationLifecycle, AnimationPlayOptions } from './animation-interface';
|
import { Animation, AnimationCallbackOptions, AnimationDirection, AnimationFill, AnimationKeyFrame, AnimationKeyFrameEdge, AnimationKeyFrames, AnimationLifecycle, AnimationPlayOptions } from './animation-interface';
|
||||||
@ -72,12 +70,12 @@ export const createAnimation = (animationId?: string): Animation => {
|
|||||||
return webAnimations;
|
return webAnimations;
|
||||||
};
|
};
|
||||||
|
|
||||||
const destroy = () => {
|
const destroy = (clearStyleSheets?: boolean) => {
|
||||||
childAnimations.forEach(childAnimation => {
|
childAnimations.forEach(childAnimation => {
|
||||||
childAnimation.destroy();
|
childAnimation.destroy(clearStyleSheets);
|
||||||
});
|
});
|
||||||
|
|
||||||
cleanUp();
|
cleanUp(clearStyleSheets);
|
||||||
|
|
||||||
elements.length = 0;
|
elements.length = 0;
|
||||||
childAnimations.length = 0;
|
childAnimations.length = 0;
|
||||||
@ -97,9 +95,12 @@ export const createAnimation = (animationId?: string): Animation => {
|
|||||||
* animation's elements, and removes the
|
* animation's elements, and removes the
|
||||||
* animation's stylesheets from the DOM.
|
* animation's stylesheets from the DOM.
|
||||||
*/
|
*/
|
||||||
const cleanUp = () => {
|
const cleanUp = (clearStyleSheets?: boolean) => {
|
||||||
cleanUpElements();
|
cleanUpElements();
|
||||||
cleanUpStyleSheets();
|
|
||||||
|
if (clearStyleSheets) {
|
||||||
|
cleanUpStyleSheets();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetFlags = () => {
|
const resetFlags = () => {
|
||||||
|
Reference in New Issue
Block a user