Home Manual Reference Source Test Repository
import {BehaviorSubject} from '@reactivex/rxjs/es6/BehaviorSubject.js'
public class | source

BehaviorSubject

Extends:

ObservableSubject → BehaviorSubject

Test:

Inherited Summary

From class Observable
public static

bindCallback(func: function, selector: function, scheduler: Scheduler): function(...params: *): Observable

Converts a callback API to a function that returns an Observable.

public static

bindNodeCallback(func: function, selector: function, scheduler: Scheduler): function(...params: *): Observable

Converts a Node.js-style callback API to a function that returns an Observable.

public static

combineLatest(observable1: ObservableInput, observable2: ObservableInput, project: function, scheduler: Scheduler): Observable

Combines multiple Observables to create an Observable whose values are calculated from the latest values of each of its input Observables.

public static

concat(input1: ObservableInput, input2: ObservableInput, scheduler: Scheduler): Observable

Creates an output Observable which sequentially emits all values from given Observable and then moves on to the next.

public static

create(onSubscription: function(observer: Observer): TeardownLogic): Observable

Creates a new Observable, that will execute the specified function when an Observer subscribes to it.

public static

Creates an Observable that, on subscribe, calls an Observable factory to make an Observable for each new Observer.

public static

empty(scheduler: Scheduler): Observable

Creates an Observable that emits no items to the Observer and immediately emits a complete notification.

public static

forkJoin(sources: *): any

public static

from(ish: ObservableInput<T>, scheduler: Scheduler): Observable<T>

Creates an Observable from an Array, an array-like object, a Promise, an iterable object, or an Observable-like object.

public static

fromEvent(target: EventTargetLike, eventName: string, options: EventListenerOptions, selector: SelectorMethodSignature<T>): Observable<T>

Creates an Observable that emits events of a specific type coming from the given event target.

public static

fromEventPattern(addHandler: function(handler: Function): any, removeHandler: function(handler: Function, signal?: any): void, selector: function(...args: any): T): Observable<T>

Creates an Observable from an API based on addHandler/removeHandler functions.

public static

fromPromise(promise: Promise<T>, scheduler: Scheduler): Observable<T>

Converts a Promise to an Observable.

public static

interval(period: number, scheduler: Scheduler): Observable

Creates an Observable that emits sequential numbers every specified interval of time, on a specified IScheduler.

public static

merge(observables: ...ObservableInput, concurrent: number, scheduler: Scheduler): Observable

Creates an output Observable which concurrently emits all values from every given input Observable.

public static

Creates an Observable that emits no items to the Observer.

public static

of(values: ...T, scheduler: Scheduler): Observable<T>

Creates an Observable that emits some values you specify as arguments, immediately one after the other, and then emits a complete notification.

public static

range(start: number, count: number, scheduler: Scheduler): Observable

Creates an Observable that emits a sequence of numbers within a specified range.

public static

throw(error: any, scheduler: Scheduler): Observable

Creates an Observable that emits no items to the Observer and immediately emits an error notification.

public static

timer(initialDelay: number | Date, period: number, scheduler: Scheduler): Observable

Creates an Observable that starts emitting after an initialDelay and emits ever increasing numbers after each period of time thereafter.

public static

webSocket(urlConfigOrSource: string | WebSocketSubjectConfig): WebSocketSubject

Wrapper around the w3c-compatible WebSocket object provided by the browser.

public static

zip(observables: *): Observable<R>

Combines multiple Observables to create an Observable whose values are calculated from the values, in order, of each of its input Observables.

public

An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable

public

audit(durationSelector: function(value: T): SubscribableOrPromise): Observable<T>

Ignores source values for a duration determined by another Observable, then emits the most recent value from the source Observable, then repeats this process.

public

auditTime(duration: number, scheduler: Scheduler): Observable<T>

Ignores source values for duration milliseconds, then emits the most recent value from the source Observable, then repeats this process.

public

buffer(closingNotifier: Observable<any>): Observable<T[]>

Buffers the source Observable values until closingNotifier emits.

public

bufferCount(bufferSize: number, startBufferEvery: number): Observable<T[]>

Buffers the source Observable values until the size hits the maximum bufferSize given.

public

bufferTime(bufferTimeSpan: number, bufferCreationInterval: number, maxBufferSize: number, scheduler: Scheduler): Observable<T[]>

Buffers the source Observable values for a specific time period.

public

bufferToggle(openings: SubscribableOrPromise<O>, closingSelector: function(value: O): SubscribableOrPromise): Observable<T[]>

Buffers the source Observable values starting from an emission from openings and ending when the output of closingSelector emits.

public

bufferWhen(closingSelector: function(): Observable): Observable<T[]>

Buffers the source Observable values, using a factory function of closing Observables to determine when to close, emit, and reset the buffer.

public

catch(selector: function): Observable

Catches errors on the observable to be handled by returning a new observable or throwing an error.

public

Converts a higher-order Observable into a first-order Observable by waiting for the outer Observable to complete, then applying combineLatest.

public

Combines multiple Observables to create an Observable whose values are calculated from the latest values of each of its input Observables.

public

Creates an output Observable which sequentially emits all values from every given input Observable after the current Observable.

public

Converts a higher-order Observable into a first-order Observable by concatenating the inner Observables in order.

public

concatMap(project: function(value: T, ?index: number): ObservableInput, resultSelector: function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any): Observable

Projects each source value to an Observable which is merged in the output Observable, in a serialized fashion waiting for each one to complete before merging the next.

public

concatMapTo(innerObservable: ObservableInput, resultSelector: function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any): Observable

Projects each source value to the same Observable which is merged multiple times in a serialized fashion on the output Observable.

public

count(predicate: function(value: T, i: number, source: Observable<T>): boolean): Observable

Counts the number of emissions on the source and emits that number when the source completes.

public

debounce(durationSelector: function(value: T): SubscribableOrPromise): Observable

Emits a value from the source Observable only after a particular time span determined by another Observable has passed without another source emission.

public

debounceTime(dueTime: number, scheduler: Scheduler): Observable

Emits a value from the source Observable only after a particular time span has passed without another source emission.

public

defaultIfEmpty(defaultValue: any): Observable

Emits a given value if the source Observable completes without emitting any next value, otherwise mirrors the source Observable.

public

delay(delay: number | Date, scheduler: Scheduler): Observable

Delays the emission of items from the source Observable by a given timeout or until a given Date.

public

delayWhen(delayDurationSelector: function(value: T): Observable, subscriptionDelay: Observable): Observable

Delays the emission of items from the source Observable by a given time span determined by the emissions of another Observable.

public

Converts an Observable of Notification objects into the emissions that they represent.

public

distinct(keySelector: function, flushes: Observable): Observable

Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.

public

Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item.

public

Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, using a property accessed by using the key provided to check if the two items are distinct.

public

do(nextOrObserver: Observer | function, error: function, complete: function): Observable

Perform a side effect for every emission on the source Observable, but return an Observable that is identical to the source.

public

elementAt(index: number, defaultValue: T): Observable

Emits the single value at the specified index in a sequence of emissions from the source Observable.

public

every(predicate: function, thisArg: any): Observable

Returns an Observable that emits whether or not every item of the source satisfies the condition specified.

public

Converts a higher-order Observable into a first-order Observable by dropping inner Observables while the previous inner Observable has not yet completed.

public

exhaustMap(project: function(value: T, ?index: number): ObservableInput, resultSelector: function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any): Observable

Projects each source value to an Observable which is merged in the output Observable only if the previous projected Observable has completed.

public

expand(project: function(value: T, index: number), concurrent: number, scheduler: Scheduler): Observable

Recursively projects each source value to an Observable which is merged in the output Observable.

public

filter(predicate: function(value: T, index: number): boolean, thisArg: any): Observable

Filter items emitted by the source Observable by only emitting those that satisfy a specified predicate.

public

find(predicate: function(value: T, index: number, source: Observable<T>): boolean, thisArg: any): Observable<T>

Emits only the first value emitted by the source Observable that meets some condition.

public

findIndex(predicate: function(value: T, index: number, source: Observable<T>): boolean, thisArg: any): Observable

Emits only the index of the first value emitted by the source Observable that meets some condition.

public

first(predicate: function(value: T, index: number, source: Observable<T>): boolean, resultSelector: function(value: T, index: number): R, defaultValue: R): Observable<T | R>

Emits only the first value (or the first value that meets some condition) emitted by the source Observable.

public

forEach(next: Function, PromiseCtor: PromiseConstructor): Promise

public

groupBy(keySelector: function(value: T): K, elementSelector: function(value: T): R, durationSelector: function(grouped: GroupedObservable<K, R>): Observable<any>): Observable<GroupedObservable<K, R>>

Groups the items emitted by an Observable according to a specified criterion, and emits these grouped items as GroupedObservables, one GroupedObservable per group.

public

Ignores all items emitted by the source Observable and only passes calls of complete or error.

public

If the source Observable is empty it returns an Observable that emits true, otherwise it emits false.

public

last(predicate: function): Observable

Returns an Observable that emits only the last item emitted by the source Observable.

public

letProto(func: *): Observable<R>

public

lift(operator: Operator): Observable

Creates a new Observable, with this Observable as the source, and the passed operator defined as the new observable's operator.

public

map(project: function(value: T, index: number): R, thisArg: any): Observable<R>

Applies a given project function to each value emitted by the source Observable, and emits the resulting values as an Observable.

public

mapTo(value: any): Observable

Emits the given constant value on the output Observable every time the source Observable emits a value.

public

Represents all of the notifications from the source Observable as next emissions marked with their original types within Notification objects.

public

max(comparer: Function): Observable

The Max operator operates on an Observable that emits numbers (or items that can be compared with a provided function), and when source Observable completes it emits a single item: the item with the largest value.

public

merge(other: ObservableInput, concurrent: number, scheduler: Scheduler): Observable

Creates an output Observable which concurrently emits all values from every given input Observable.

public

mergeAll(concurrent: number): Observable

Converts a higher-order Observable into a first-order Observable which concurrently delivers all values that are emitted on the inner Observables.

public

mergeMap(project: function(value: T, ?index: number): ObservableInput, resultSelector: function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any, concurrent: number): Observable

Projects each source value to an Observable which is merged in the output Observable.

public

mergeMapTo(innerObservable: ObservableInput, resultSelector: function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any, concurrent: number): Observable

Projects each source value to the same Observable which is merged multiple times in the output Observable.

public

mergeScan(accumulator: function(acc: R, value: T): Observable<R>, seed: *, concurrent: number): Observable<R>

Applies an accumulator function over the source Observable where the accumulator function itself returns an Observable, then each intermediate Observable returned is merged into the output Observable.

public

min(comparer: Function): Observable<R>

The Min operator operates on an Observable that emits numbers (or items that can be compared with a provided function), and when source Observable completes it emits a single item: the item with the smallest value.

public

multicast(subjectOrSubjectFactory: Function | Subject, selector: Function): Observable

Returns an Observable that emits the results of invoking a specified selector on items emitted by a ConnectableObservable that shares a single subscription to the underlying stream.

public

observeOn(scheduler: *, delay: *): Observable<R> | WebSocketSubject<T> | Observable<T>

public

Groups pairs of consecutive emissions together and emits them as an array of two values.

public

partition(predicate: function(value: T, index: number): boolean, thisArg: any): [Observable<T>, Observable<T>]

Splits the source Observable into two, one with values that satisfy a predicate, and another with values that don't satisfy the predicate.

It's like filter, but returns two Observables: one like the output of filter, and the other with values that did not pass the condition.

public

pluck(properties: ...string): Observable

Maps each source value (an object) to its specified nested property.

public

publish(selector: Function): *

Returns a ConnectableObservable, which is a variety of Observable that waits until its connect method is called before it begins emitting items to those Observers that have subscribed to it.

public
public
public

publishReplay(bufferSize: *, windowTime: *, scheduler: *): ConnectableObservable<T>

public

Returns an Observable that mirrors the first source Observable to emit an item from the combination of this Observable and supplied Observables.

public

reduce(accumulator: function(acc: R, value: T, index: number): R, seed: R): Observable<R>

Applies an accumulator function over the source Observable, and returns the accumulated result when the source completes, given an optional seed value.

public

Returns an Observable that repeats the stream of items emitted by the source Observable at most count times.

public

repeatWhen(notifier: function(notifications: Observable): Observable): Observable

Returns an Observable that mirrors the source Observable with the exception of a complete.

public

Returns an Observable that mirrors the source Observable with the exception of an error.

public

Returns an Observable that mirrors the source Observable with the exception of an error.

public

sample(notifier: Observable<any>): Observable<T>

Emits the most recently emitted value from the source Observable whenever another Observable, the notifier, emits.

public

sampleTime(period: number, scheduler: Scheduler): Observable<T>

Emits the most recently emitted value from the source Observable within periodic time intervals.

public

scan(accumulator: function(acc: R, value: T, index: number): R, seed: T | R): Observable<R>

Applies an accumulator function over the source Observable, and returns each intermediate result, with an optional seed value.

public

sequenceEqual(compareTo: Observable, comparor: function): Observable

Compares all values of two observables in sequence using an optional comparor function and returns an observable of a single boolean value representing whether or not the two sequences are equal.

public

Returns a new Observable that multicasts (shares) the original Observable.

public

single(predicate: Function): Observable<T>

Returns an Observable that emits the single item emitted by the source Observable that matches a specified predicate, if that Observable emits one such item.

public

Returns an Observable that skips the first count items emitted by the source Observable.

public

Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.

public

skipWhile(predicate: Function): Observable<T>

Returns an Observable that skips all items emitted by the source Observable as long as a specified condition holds true, but emits all further source items as soon as the condition becomes false.

public

startWith(values: ...T, scheduler: Scheduler): Observable

Returns an Observable that emits the items you specify as arguments before it begins to emit items emitted by the source Observable.

public

subscribeOn(scheduler: Scheduler): Observable<T>

Asynchronously subscribes Observers to this Observable on the specified IScheduler.

public

Converts a higher-order Observable into a first-order Observable by subscribing to only the most recently emitted of those inner Observables.

public

switchMap(project: function(value: T, ?index: number): ObservableInput, resultSelector: function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any): Observable

Projects each source value to an Observable which is merged in the output Observable, emitting values only from the most recently projected Observable.

public

switchMapTo(innerObservable: ObservableInput, resultSelector: function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any): Observable

Projects each source value to the same Observable which is flattened multiple times with switch in the output Observable.

public

take(count: number): Observable<T>

Emits only the first count values emitted by the source Observable.

public

takeLast(count: number): Observable<T>

Emits only the last count values emitted by the source Observable.

public

Emits the values emitted by the source Observable until a notifier Observable emits a value.

public

takeWhile(predicate: function(value: T, index: number): boolean): Observable<T>

Emits values emitted by the source Observable so long as each value satisfies the given predicate, and then completes as soon as this predicate is not satisfied.

public

throttle(durationSelector: function(value: T): SubscribableOrPromise): Observable<T>

Emits a value from the source Observable, then ignores subsequent source values for a duration determined by another Observable, then repeats this process.

public

throttleTime(duration: number, scheduler: Scheduler): Observable<T>

Emits a value from the source Observable, then ignores subsequent source values for duration milliseconds, then repeats this process.

public

timeInterval(scheduler: *): Observable<TimeInterval<any>> | WebSocketSubject<T> | Observable<T>

public

timeout(due: number, scheduler: Scheduler): Observable<R> | WebSocketSubject<T> | Observable<T>

public

timeoutWith(due: *, withObservable: *, scheduler: *): Observable<R> | WebSocketSubject<T> | Observable<T>

public

timestamp(scheduler: *): Observable<Timestamp<any>> | WebSocketSubject<T> | Observable<T>

public
public

toPromise(PromiseCtor: *): Promise<T>

Converts an Observable sequence to a ES2015 compliant promise.

public

window(windowBoundaries: Observable<any>): Observable<Observable<T>>

Branch out the source Observable values as a nested Observable whenever windowBoundaries emits.

public

windowCount(windowSize: number, startWindowEvery: number): Observable<Observable<T>>

Branch out the source Observable values as a nested Observable with each nested Observable emitting at most windowSize values.

public

windowToggle(openings: Observable<O>, closingSelector: function(value: O): Observable): Observable<Observable<T>>

Branch out the source Observable values as a nested Observable starting from an emission from openings and ending when the output of closingSelector emits.

public

windowWhen(closingSelector: function(): Observable): Observable<Observable<T>>

Branch out the source Observable values as a nested Observable using a factory function of closing Observables to determine when to start a new window.

public

Combines the source Observable with other Observables to create an Observable whose values are calculated from the latest values of each, only when the source emits.

public

zipAll(project: *): Observable<R> | WebSocketSubject<T> | Observable<T>

public

zipProto(observables: *): Observable<R>