From 1d626c1357f8c1238e8601b882ff2755e49902f7 Mon Sep 17 00:00:00 2001 From: Matin <52866914+Matin297@users.noreply.github.com> Date: Tue, 23 Jan 2024 19:18:35 +0330 Subject: [PATCH] internals: refactor stop animations resolve mechanism (#1780) * internals: refactor stop animations resolve mechanism * remove cancel/finish listeners from stop animations function --- src/internal/animate.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/internal/animate.ts b/src/internal/animate.ts index bc86c5750c..721cddf3df 100644 --- a/src/internal/animate.ts +++ b/src/internal/animate.ts @@ -45,11 +45,8 @@ export function stopAnimations(el: HTMLElement) { return Promise.all( el.getAnimations().map(animation => { return new Promise(resolve => { - const handleAnimationEvent = requestAnimationFrame(resolve); - - animation.addEventListener('cancel', () => handleAnimationEvent, { once: true }); - animation.addEventListener('finish', () => handleAnimationEvent, { once: true }); animation.cancel(); + requestAnimationFrame(resolve); }); }) );