kopia lustrzana https://github.com/shoelace-style/shoelace
internals: refactor stop animations resolve mechanism (#1780)
* internals: refactor stop animations resolve mechanism * remove cancel/finish listeners from stop animations functionpull/1836/head
rodzic
caf47069c0
commit
1d626c1357
|
@ -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);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
|
Ładowanie…
Reference in New Issue