mirror of https://github.com/sveltejs/svelte
parent
e3d7f3986f
commit
eaf15c5f00
@ -0,0 +1,14 @@
|
||||
import { ssr_context } from './context.js';
|
||||
import { once } from './index.js';
|
||||
|
||||
/**
|
||||
* @template V
|
||||
* @param {() => V} fn
|
||||
*/
|
||||
export function derived(fn) {
|
||||
if (ssr_context !== null) {
|
||||
return once(fn);
|
||||
}
|
||||
|
||||
return fn;
|
||||
}
|
||||
Loading…
Reference in new issue