PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / QuickEdit / lib / after-animations.js

after-animations.js in Extendify trunk, at src/QuickEdit/lib/after-animations.js

14 lines 485 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // A block entering on scroll measures where the animation starts.
2 export const whenAnimationsSettle = (el, onSettled) => {
3 const running = el?.getAnimations?.({ subtree: true }) ?? [];
4 if (!running.length) return () => {};
5 let dropped = false;
6 Promise.all(running.map((animation) => animation.finished))
7 .then(() => !dropped && onSettled())
8 // A cancelled animation rejects, and means nothing landed to re-measure.
9 .catch(() => {});
10 return () => {
11 dropped = true;
12 };
13 };
14