Skip to main content

ofWithNotifications

Alternative: ofN

Types

function ofWithNotifications<GValue>(
...values: GValue[]
): IObservable<IOfObservableNotifications<GValue>>
type IOfObservableNotifications<GValue> = IFromArrayObservableNotifications<GValue>;

Definition

Creates an Observable from a list of values. It emits the values one by one in the form of next Notifications and then complete (complete Notification).

It's identical of fromArrayWithNotifications but use spread values instead.

Example

Emit the sequence of values: 0, 1, 2, 3

const subscribe = ofWithNotifications(0, 1, 2, 3);

subscribe((notification) => {
console.log(notification.name, ':', notification.value);
});

Output:

next: 0
next: 1
next: 2
next: 3
complete