Better waitForAnimation end function (?). Maybe it was better before....

This commit is contained in:
Ulysse Cura 2026-03-10 21:07:08 +01:00
parent eedcb0a8c9
commit 313787cf55
1 changed files with 4 additions and 7 deletions

View File

@ -1,16 +1,13 @@
function waitForAnimationEnd(elem, animationName) function waitForAnimationEnd(elem, animation_name)
{ {
return new Promise(resolve => { return new Promise(resolve => {
function handleAnimationEnd(evt) elem.onanimationend = (event) => {
{ if(event.animationName === animation_name)
if (evt.animationName === animationName)
{ {
elem.onanimationend = null; elem.onanimationend = null;
resolve(); resolve();
} }
} };
elem.onanimationend = handleAnimationEnd;
}); });
} }