Skip to content

Commit

Permalink
fix(esl-utils): fix event cancellation handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ala-n committed Apr 7, 2024
1 parent 20d337d commit dffbc53
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modules/esl-utils/async/promise/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ export function promisifyTransition(
): Promise<void> {
return new Promise((resolve) => {
function transitionCallback(e: TransitionEvent): void {
if (e.target !== $el) return;
if (typeof props === 'string' && props !== e.propertyName) return;
$el.removeEventListener('transitionend', transitionCallback);
$el.removeEventListener('transitioncancel', transitionCallback);
resolve();
}
$el.addEventListener('transitionend', transitionCallback);
$el.addEventListener('transitioncancel', transitionCallback);
});
}

0 comments on commit dffbc53

Please sign in to comment.