A function, or class constructor producing a value that will be cached by
$``() as a permanent-per-signal constant at a given call site.
The function or constructor will be run without an active job, and its
value cached. While it runs, any attempt to directly access a reactive value
or expression will be blocked by a thrown error, to prevent your cached
result from capturing a stale value.
Note that unlike SingletonFactory, a ConstantFactory cannot use job
APIs, rules, or fx(), nor is there any special handling for generator
functions. None of these things make any sense for a lazy constant, as there
is no way to clean up after them: they simply exist for the life of the
signal and so should be relatively stateless.
A function, or class constructor producing a value that will be cached by
$``()as a permanent-per-signal constant at a given call site.The function or constructor will be run without an active job, and its value cached. While it runs, any attempt to directly access a reactive value or expression will be blocked by a thrown error, to prevent your cached result from capturing a stale value.
Note that unlike SingletonFactory, a ConstantFactory cannot use job APIs, rules, or fx(), nor is there any special handling for generator functions. None of these things make any sense for a lazy constant, as there is no way to clean up after them: they simply exist for the life of the signal and so should be relatively stateless.