Computed -> Computed<T> ¶
function Fusion.Computed<T, S>(
scope: Scope<S>,
processor: (Use, Scope<S>) -> T
) -> Computed<T>
Constructs and returns a new computed state object.
Use scoped() method syntax
This function is intended to be accessed as a method on a scope:
local computed = scope:Computed(processor)
Parameters¶
scope : Scope<S> ¶
The scope which should be used to store destruction tasks for this object.
processor : (Use, Scope<S>) -> T ¶
Computes the value that will be used by the computed. The processor is given a use function for including other objects in the computation, and a scope for queueing destruction tasks to run on re-computation. The given scope has the same methods as the scope used to create the computed.
Returns -> Computed<T> ¶
A freshly constructed computed state object.