Function writableDerived
- writableDerived<S extends Stores, T>(
origins: S,
derive: (values: StoresValues<S>) => T,
reflect: (reflecting: T, old: StoresValues<S>) => SetValues<S>,
initial?: T,
): Writable<T> Type Parameters
- S extends Stores
- T
Parameters
- origins: S
One or more stores to derive from. Same as
derived
's 1st parameter. - derive: (values: StoresValues<S>) => T
The callback to determine the derived value. Same as
derived
's 2nd parameter. - reflect: (reflecting: T, old: StoresValues<S>) => SetValues<S>
Called when the derived store gets a new value via its
set
orupdate
methods, and determines new values for the origin stores. Read more... Optional
initial: TThe new store's initial value. Same as
derived
's 3rd parameter.
Returns Writable<T>
A writable store.
- writableDerived<S extends Stores, T>(
origins: S,
derive: (
values: StoresValues<S>,
set: (value: T) => void,
update: (fn: Updater<T>) => void,
) => void,
reflect: (reflecting: T, old: StoresValues<S>) => SetValues<S>,
initial?: T,
): Writable<T> Create a store similar to Svelte's
derived
, but which has its ownset
andupdate
methods and can send values back to the origin stores. Read more...Type Parameters
- S extends Stores
- T
Parameters
- origins: S
One or more stores to derive from. Same as
derived
's 1st parameter. - derive: (
values: StoresValues<S>,
set: (value: T) => void,
update: (fn: Updater<T>) => void,
) => voidThe callback to determine the derived value. Same as
derived
's 2nd parameter. - reflect: (reflecting: T, old: StoresValues<S>) => SetValues<S>
Called when the derived store gets a new value via its
set
orupdate
methods, and determines new values for the origin stores. Read more... Optional
initial: TThe new store's initial value. Same as
derived
's 3rd parameter.
Returns Writable<T>
A writable store.
Create a store similar to Svelte's
derived
, but which has its ownset
andupdate
methods and can send values back to the origin stores. Read more...