diff --git a/packages/svelte/src/index-client.js b/packages/svelte/src/index-client.js index ff0282fb2c..92e35ac558 100644 --- a/packages/svelte/src/index-client.js +++ b/packages/svelte/src/index-client.js @@ -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 * @param {() => NotFunction | Promise> | (() => any)} fn * @returns {void} */ -export function onFrame(fn) { +export function onAnimationFrame(fn) { onMount(() => { let frame = -1; diff --git a/packages/svelte/src/index-server.js b/packages/svelte/src/index-server.js index af22f25d7f..2fc726617c 100644 --- a/packages/svelte/src/index-server.js +++ b/packages/svelte/src/index-server.js @@ -12,7 +12,7 @@ export function onDestroy(fn) { export { noop as beforeUpdate, noop as afterUpdate, - noop as onFrame, + noop as onAnimationFrame, noop as onMount, noop as flushSync, run as untrack diff --git a/packages/svelte/types/index.d.ts b/packages/svelte/types/index.d.ts index c859a7d793..bc1ce3ca98 100644 --- a/packages/svelte/types/index.d.ts +++ b/packages/svelte/types/index.d.ts @@ -411,12 +411,12 @@ declare module 'svelte' { * */ 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(fn: () => NotFunction | Promise> | (() => any)): void; + export function onAnimationFrame(fn: () => NotFunction | Promise> | (() => any)): void; /** * Create a snippet programmatically * */