ReplaySubject

A variant of Subject that "replays" or emits old values to new subscribers. It buffers a set number of values and will emit those values immediately to any new subscribers in addition to emitting new values to existing subscribers.

class ReplaySubject<T> extends Subject { constructor(bufferSize: number = Number.POSITIVE_INFINITY, windowTime: number = Number.POSITIVE_INFINITY, scheduler?: SchedulerLike) _subscribe(subscriber: Subscriber<T>): Subscription _getNow(): number // inherited from index/Subject static create: Function constructor() observers: Observer<T>[] closed: false isStopped: false hasError: false thrownError: any lift<R>(operator: Operator<T, R>): Observable<R> next(value?: T) error(err: any) complete() unsubscribe() _trySubscribe(subscriber: Subscriber<T>): TeardownLogic _subscribe(subscriber: Subscriber<T>): Subscription asObservable(): Observable<T> // inherited from index/Observable static create: Function static if: typeof iif static throw: typeof throwError constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic) _isScalar: boolean source: Observable<any> operator: Operator<any, T> lift<R>(operator: Operator<T, R>): Observable<R> subscribe(observerOrNext?: PartialObserver<T> | ((value: T) => void), error?: (error: any) => void, complete?: () => void): Subscription _trySubscribe(sink: Subscriber<T>): TeardownLogic forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise<void> pipe(...operations: OperatorFunction<any, any>[]): Observable<any> toPromise(promiseCtor?: PromiseConstructorLike): Promise<T> }

Constructor

constructor(bufferSize: number = Number.POSITIVE_INFINITY, windowTime: number = Number.POSITIVE_INFINITY, scheduler?: SchedulerLike)

Parameters

bufferSize

Optional. Default is Number.POSITIVE_INFINITY.

Type: number.

windowTime

Optional. Default is Number.POSITIVE_INFINITY.

Type: number.

scheduler

Optional. Default is undefined.

Type: SchedulerLike.

Methods

_subscribe()

_subscribe(subscriber: Subscriber<T>): Subscription

Parameters

subscriber

Type: Subscriber.

Returns

Subscription

_getNow()

_getNow(): number

Parameters

There are no parameters.

Returns

number