-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rely on
node.getAnimations()
to know when transitions are done
Up until now, we've tried to do this ourselves by listening to the correct events. The new `node.getAnimations()` API is a much simpler API to use. The only requirement is that we call `node.getAnimations()` in a `requestAnimationFrame` so that the browser can flush all the changes. We couldn't do this before, because we needed to setup the event listeners to prevent race conditions. Now there are no race conditions, in fact, if all transitions already complete before we can call the `waitForTransition`, then the `node.getAnimations()` list will be empty and we can call the `done()` function. The `Element.prototype.getAnimations` has been available in browsers since mid 2020, but at the time it was too new to use. Now seems like a safe time to use this. See: https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations#browser_compatibility
- Loading branch information
1 parent
d0513eb
commit 62a2ae2
Showing
1 changed file
with
22 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters