Prev Next

Web / RxJs Interview questions

Explain Observer in RXJS.

Observer is an interface for a consumer of push-based notifications delivered by an Observable.

It has below structure,

interface Observer<T> {
closed?: boolean;
next: (value: T) => void;
error: (err: any) => void;
complete: () => void;
}

A handler that implements the Observer interface for receiving observable notifications will be passed as a parameter for observable as below.

myObservable.subscribe(myObserver)

More Related questions...

Show more question and Answers...


Comments & Discussions