@epikodelabs/streamix / src/public-api / lastValueFrom
Function: lastValueFrom()
lastValueFrom<
T>(source):Promise<T>
Defined in: projects/libraries/streamix/src/lib/factories/lastValueFrom.ts:17
Returns a promise that resolves with the last emitted value from an AtomBase or atom.
- Successful resolution: The promise resolves with the last value emitted by the source, after the source has completed.
- Rejection on error: If the source emits an error, the promise is rejected.
- Rejection on no value: If the source completes without emitting any values, the promise is rejected with a specific error message.
Type Parameters
T
T = any
The type of the value expected from the source.
Parameters
source
The source stream or atom to listen to for the final value.
Atom<T> | AsyncIterable<T, any, any>
Returns
Promise<T>
A promise that resolves with the last value from the source or rejects on completion without a value or on error.