MCPcopy
hub / github.com/sveltejs/svelte / of

Method of

packages/svelte/src/motion/spring.js:230–238  ·  view source on GitHub ↗

* Create a spring whose value is bound to the return value of `fn`. This must be called * inside an effect root (for example, during component initialisation). * * ```svelte * <script> * import { Spring } from 'svelte/motion'; * * let { number } = $props(); * * const spring = Sp

(fn, options)

Source from the content-addressed store, hash-verified

228 * @param {SpringOptions} [options]
229 */
230 static of(fn, options) {
231 const spring = new Spring(fn(), options);
232
233 render_effect(() => {
234 spring.set(fn());
235 });
236
237 return spring;
238 }
239
240 /** @param {T} value */
241 #update(value) {

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
render_effectFunction · 0.90
fnFunction · 0.50

Tested by

no test coverage detected