notificationsToValuesObservablePipe
Alternative: notificationsToValues$$$
Inlined: notificationsToValuesObservable, notificationsToValues$$
Types
function notificationsToValuesObservablePipe<GValue>(
onError?: INotificationsToValuesObservableOnErrorFunction,
maxNumberOfValues?: number,
): IObservablePipe<IDefaultInNotificationsUnion<GValue>, GValue[]>
Definition
Accumulates all values emitted using next Notifications, until complete is received.
Then emit these values as an array.
You may provide:
onError: called when anerrorNotification is received. In this case the Observable never emits.maxNumberOfValues: maximal size of the array containing the values (retainsmaxNumberOfValueslast values).
Diagram
Example
Converts an observable of notifications to a simple Observable
const subscribe = pipe$$(fromArrayWithNotifications([1, 2, 3, 4]), [
notificationsToValues$$$<number>(),
]);
subscribe((values: number[]) => {
console.log(values);
});
Output:
[1, 2, 3, 4]