|
|
|
@ -208,15 +208,15 @@ export function afterUpdate(fn) {
|
|
|
|
* @returns {void}
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export function onAnimationFrame(fn) {
|
|
|
|
export function onAnimationFrame(fn) {
|
|
|
|
onMount(() => {
|
|
|
|
if (component_context === null) {
|
|
|
|
let frame = -1;
|
|
|
|
lifecycle_outside_component('onAnimationFrame');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function next() {
|
|
|
|
user_effect(() => {
|
|
|
|
|
|
|
|
let frame = requestAnimationFrame(function next() {
|
|
|
|
frame = requestAnimationFrame(next);
|
|
|
|
frame = requestAnimationFrame(next);
|
|
|
|
fn();
|
|
|
|
fn();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
return () => {
|
|
|
|
cancelAnimationFrame(frame);
|
|
|
|
cancelAnimationFrame(frame);
|
|
|
|
|