Interface MinimalWritableFn<T, Args, R>
interface MinimalWritableFn<T, Args extends unknown[], R = void> {
set(this: void, value: T): void;
subscribe(
this: void,
run: Subscriber<T>,
invalidate?: Invalidator<T>,
): Unsubscriber;
(...args: Args): R;
}
set(this: void, value: T): void;
subscribe(
this: void,
run: Subscriber<T>,
invalidate?: Invalidator<T>,
): Unsubscriber;
(...args: Args): R;
}
Type Parameters
- T
The type of value stored in the minimal writable store.
- Args extends unknown[]
The tuple of argument types accepted by the function.
- R = void
The return type of the function.
Hierarchy
- MinimalWritable<T>
- MinimalWritableFn (View Summary)
Methods
set
subscribe
-
Subscribe on value changes.
Parameters
- this: void
- run: Subscriber<T>
subscription callback
Optionalinvalidate: Invalidator<T>cleanup callback
Returns Unsubscriber
Combines a minimal writable Svelte store with a callable function. This type allows a minimal writable store to also act as a function enabling flexible reactive behavior.