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

Function reactive_import

packages/svelte/src/internal/client/dom/legacy/misc.js:10–22  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

8 * @param {() => any} fn
9 */
10export function reactive_import(fn) {
11 var s = source(0);
12
13 return function () {
14 if (arguments.length === 1) {
15 set(s, get(s) + 1);
16 return arguments[0];
17 } else {
18 get(s);
19 return fn();
20 }
21 };
22}
23
24/**
25 * @this {any}

Callers

nothing calls this directly

Calls 4

sourceFunction · 0.90
setFunction · 0.90
getFunction · 0.90
fnFunction · 0.50

Tested by

no test coverage detected