useEventual
function useEventual<T, S>(
scope: Fusion.Scope<S & typeof(Fusion)>,
fallback: T,
processor: (use: Fusion.Use, become: Become, scope: Fusion.Scope<S>) -> T
): Fusion.StateObject<T>
Returns a state object with an eventual value from a processor. The processor is given a Use callback that adds dependencies, a Become callback alter the current eventual value, and an inner scope to add cleanup tasks to.
Not recommended for production usage
This API has not been stablized. It's call signature may be altered in the future, it may throw bugs, or it may be outright removed in later releases. Use at your own risk.
Parameters
scope : Fusion.Scope<S & typeof(Fusion)>
The scope to store cleanup tasks.
fallback : T
The fallback value to display while the processor runs.
processor : (use: Fusion.Use, become: Become, scope: Fusion.Scope<S>) -> T
The processor of the eventual value. It receives a Use callback, a Become callback, and an inner scope.
Returns -> Fusion.StateObject<T>
A state object with the asynchronous value.
Example Usage
-- TODO: write example