Angular Signal Generators is a library to help expand the usefulness of signals. This is done by exposing purpose built signals meant to simplify common tasks encountered in Components. They work like vanilla signals, but with extra capabilities built in.
$id = signal(0); // call getCustomer every time $id changes. $customer = asyncSignal(() => this.$id() !== 0 ? this.getCustomer(this.$id()) : undefined);
const liftedArray = liftSignal([1, 2, 3], null, ['push']); liftedArray.push(4) console.log(liftedArray()); // [1, 2, 3, 4];
Array.reduce
or Rxjs's scan
operator, using a reducer function to create a new value from the current and prior values. for async
loop.
const source = signal('start'); for await (const item of signalToIterator(source)) { console.log(item); // 'start', 'next' } source.next('next');