rename to onAnimationFrame

onframe
Rich Harris 5 months ago
parent db90c4ca65
commit fbf247d268

@ -199,15 +199,15 @@ export function afterUpdate(fn) {
} }
/** /**
* The `onFrame` function schedules a callback to run on `requestAnimationFrame`. It must be called inside an effect (e.g. during component initialisation). * The `onAnimationFrame` function schedules a callback to run on `requestAnimationFrame`. It must be called inside an effect (e.g. during component initialisation).
* *
* `onFrame` does not run inside [server-side components](https://svelte.dev/docs/svelte/svelte-server#render). * `onAnimationFrame` does not run inside [server-side components](https://svelte.dev/docs/svelte/svelte-server#render).
* *
* @template T * @template T
* @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn * @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn
* @returns {void} * @returns {void}
*/ */
export function onFrame(fn) { export function onAnimationFrame(fn) {
onMount(() => { onMount(() => {
let frame = -1; let frame = -1;

@ -12,7 +12,7 @@ export function onDestroy(fn) {
export { export {
noop as beforeUpdate, noop as beforeUpdate,
noop as afterUpdate, noop as afterUpdate,
noop as onFrame, noop as onAnimationFrame,
noop as onMount, noop as onMount,
noop as flushSync, noop as flushSync,
run as untrack run as untrack

@ -411,12 +411,12 @@ declare module 'svelte' {
* */ * */
export function afterUpdate(fn: () => void): void; export function afterUpdate(fn: () => void): void;
/** /**
* The `onFrame` function schedules a callback to run on `requestAnimationFrame`. It must be called inside an effect (e.g. during component initialisation). * The `onAnimationFrame` function schedules a callback to run on `requestAnimationFrame`. It must be called inside an effect (e.g. during component initialisation).
* *
* `onFrame` does not run inside [server-side components](https://svelte.dev/docs/svelte/svelte-server#render). * `onAnimationFrame` does not run inside [server-side components](https://svelte.dev/docs/svelte/svelte-server#render).
* *
* */ * */
export function onFrame<T>(fn: () => NotFunction<T> | Promise<NotFunction<T>> | (() => any)): void; export function onAnimationFrame<T>(fn: () => NotFunction<T> | Promise<NotFunction<T>> | (() => any)): void;
/** /**
* Create a snippet programmatically * Create a snippet programmatically
* */ * */

Loading…
Cancel
Save