Creates a computed signal using the given compute function to update its value. This is equivalent to computed(fn)
;
The signal value type.
The compute function called to calculate the actual value.
Optional
options: BaseSignalOptions<T>Optional signal options.
The creates computed signal.
Creates an ObserverSignal which observes the given observable, either using the given initial signal value or requiring the observable to emit an initial value on subscribe.
To prevent memory leaks you must either manually destroy the signal with the ObserverSignal.destroy method or use a SignalContext which automatically destroys observer signals created within the context when the context is destroyed.
The signal value type.
The observable to subscribe to.
Optional signal options.
The created observer signal.
Creates an ObserverSignal which observes the given observable. With no initialValue
set and requireSync
not set to true the signal value will
include undefined
as valid value. If you don't want that then either specify an initialValue
in the signal options or use the requireSync
option to
define that the observable does emit a value synchronously on subscription.
To prevent memory leaks you must either manually destroy the signal with the ObserverSignal.destroy method or use a SignalContext which automatically destroys observer signals created within the context when the context is destroyed.
The signal value type.
The observable to subscribe to.
Optional
options: ObserverSignalOptions<T>Optional signal options.
The created observer signal.
Creates a Signal from the given signal source, which can be an observable, a function or already a signal, which is then returned unchanged.
The signal value type.
The signal source. If it is a function, then a ComputedSignal is created. If it is an observable, then an ObserverSignal is created. If the source is already a signal then it is returned as-is.
Optional signal options. Ignored when source is a signal. If source is an observable then you may want to set the initialValue
or
requireSync
option to prevent the signal value to be undefined initially.
The created signal.
Creates a Signal from the given signal source, which can be an observable, a function or already a signal, which is then returned unchanged.
The signal value type.
The signal source. If it is a function, then a ComputedSignal is created. If it is an observable, then an ObserverSignal is created. If the source is already a signal then it is returned as-is.
Optional
options: ObserverSignalOptions<T>Optional signal options. Ignored when source is a signal. If source is an observable then you may want to set the initialValue
or
requireSync
option to prevent the signal value to be undefined initially.
The created signal.
Simply returns the given signal. This signature is just present so toSignal can be used universally to create a signal from an arbitrary source, even when the source is already a signal.