Skip to content

Commit

Permalink
internals: refactor stop animations resolve mechanism (#1780)
Browse files Browse the repository at this point in the history
* internals: refactor stop animations resolve mechanism

* remove cancel/finish listeners from stop animations function
  • Loading branch information
Matin297 committed Jan 23, 2024
1 parent caf4706 commit 1d626c1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/internal/animate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
})
);
Expand Down

0 comments on commit 1d626c1

Please sign in to comment.