class
stable
A variant of Subject that requires an initial value and emits its current value whenever it is subscribed to.
class BehaviorSubject<T> extends Subject { constructor(_value: T) get value: T _subscribe(subscriber: Subscriber<T>): Subscription getValue(): T next(value: T): void // 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(_value: T)
_value | Type: |
Property | Type | Description |
---|---|---|
value | T | Read-only. |
_subscribe(subscriber: Subscriber<T>): Subscription
subscriber | Type: |
Subscription
getValue(): T
There are no parameters.
T
next(value: T): void
value | Type: |
void
© 2015–2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors.
Code licensed under an Apache-2.0 License. Documentation licensed under CC BY 4.0.
https://rxjs.dev/api/index/class/BehaviorSubject