internals: refactor stop animations resolve mechanism (#1780)

* internals: refactor stop animations resolve mechanism

* remove cancel/finish listeners from stop animations function
pull/1836/head
Matin 2024-01-23 19:18:35 +03:30 zatwierdzone przez GitHub
rodzic caf47069c0
commit 1d626c1357
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 1 dodań i 4 usunięć

Wyświetl plik

@ -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);
});
})
);