@epikodelabs/streamix / src/public-api / derived
Function: derived()
Call Signature
derived<
T>(fn,options?):Atom<T>
Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:1666
Creates a readonly atom computed from other atoms.
Dependencies are tracked when the callback reads atoms through self.read, self.use, or the callable shorthand self(atom).
derived() is intentionally synchronous. If the computation needs await, cancellation, or restart semantics, model it as a flow() instead.
Type Parameters
T
T
Parameters
fn
(self) => SyncOnly<T>
options?
Returns
Atom<T>
Call Signature
derived<
T>(fn,options?):Atom<T>
Defined in: projects/libraries/streamix/src/lib/atoms/atom.ts:1672
Creates a readonly atom from a generator-based computation.
The generator may yield atoms or promises before returning the computed value.
Type Parameters
T
T
Parameters
fn
(self) => Generator<Promise<any> | Atom<any>, T, any>
options?
Returns
Atom<T>