Takes an async source (Promise, Observable) or signal/function that returns an async source
and returns that source's values as part of a signal. Kind of like an rxjs flattening operator.
When the async source changes, the old source is immediately released and the new source is listened.
Param: valueSource
A Promise or Subscribable to create writable signal,
otherwise a signal or function that returns a Promise or Subscribable.
Param: options
The options for the async signal
Returns
a signal that returns values from the async source..
Example
$id = signal(0); // call getCustomer every time $id changes. $customer = asyncSignal(() =>this.$id() !== 0 ? this.getCustomer(this.$id()) : undefined);
Takes an async source (Promise, Observable) or signal/function that returns an async source and returns that source's values as part of a signal. Kind of like an rxjs flattening operator. When the async source changes, the old source is immediately released and the new source is listened.
Param: valueSource
A Promise or Subscribable to create writable signal, otherwise a signal or function that returns a Promise or Subscribable.
Param: options
The options for the async signal
Returns
a signal that returns values from the async source..
Example