Skip to main content
Module

x/rxjs/mod.ts

Deno port of RXJS
Latest
import * as rxjs from "https://deno.land/x/rxjs@v1.0.2/mod.ts";

Classes

A variant of Subject that only emits a value when it completes. It will emit its latest value to all its observers on completion.

A variant of Subject that requires an initial value and emits its current value whenever it is subscribed to.

c
Notification
deprecated

Represents a push-based event or value that an Observable can emit. This class is particularly useful for operators that manage notifications, like materialize, dematerialize, observeOn, and others. Besides wrapping the actual delivered value, it also annotates it with metadata of, for instance, what type of push message it is (next, error, or complete).

A representation of any set of values over any amount of time. This is the most basic building block of RxJS.

A variant of Subject that "replays" old values to new subscribers by emitting them when they first subscribe.

c
Scheduler
deprecated

An execution context and a data structure to order tasks and schedule their execution. Provides a notion of (potentially virtual) time, through the now() getter method.

A Subject is a special type of Observable that allows values to be multicasted to many Observers. Subjects are like EventEmitters.

Implements the Observer interface and extends the Subscription class. While the Observer is the public API for consuming the values of an Observable, all Observers get converted to a Subscriber, in order to provide Subscription-like capabilities such as unsubscribe. Subscriber is a common type in RxJS, and crucial for implementing operators, but it is rarely used as a public API.

Represents a disposable resource, such as the execution of an Observable. A Subscription has one important method, unsubscribe, that takes no argument and just disposes the resource held by the subscription.

Variables

v
animationFrame
deprecated

Animation Frame Scheduler

An error thrown when an element was queried at a certain index of an Observable, but no such index or position exists in that sequence.

v
asap
deprecated

Asap Scheduler

v
async
deprecated

Async Scheduler

v
combineAll
deprecated

The GlobalConfig object for RxJS. It is used to configure things like how to react on unhandled errors.

A simple Observable that emits no items to the Observer and immediately emits a complete notification.

An error thrown when an Observable or a sequence was queried but has no elements.

v
exhaust
deprecated
v
flatMap
deprecated

An Observable that emits no items to the Observer and never completes.

An error thrown when a value or values are missing from an observable sequence.

An error thrown when an action is invalid because the object has been unsubscribed.

Symbol.observable or a string "@@observable". Used for interop

v
queue
deprecated

Queue Scheduler

An error thrown when something is wrong with the sequence of values arriving on the observable.

An error thrown by the timeout operator.

An error thrown when one or more errors have occurred during the unsubscribe of a Subscription.

Functions

An observable of animation frames

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

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

Buffers the source Observable values until closingNotifier emits.

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

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

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

You have passed any here, we can't figure out if it is an array or an object, so you're getting unknown. Use better types.

Create an observable that combines the latest values from all passed observables and the source into arrays and emits them.

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

Emits all of the values from the source observable, then, once it completes, subscribes to each observable source provided, one at a time, emitting all of their values, and not subscribing to the next one until it completes.

Creates an observable by multicasting the source within a function that allows the developer to define the usage of the multicast prior to connection.

Creates an observable that multicasts once connect() is called on it.

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

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

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

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

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

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

f
delayWhen
deprecated

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

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

Returns a result Observable that emits all values pushed by the source observable if they are distinct in comparison to the last value the result observable emitted.

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

f
empty
deprecated
f
endWith
deprecated

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

f
filter
deprecated

Returns an Observable that mirrors the source Observable, but will call a specified function when the source terminates on complete or error. The specified function will also be called when the subscriber explicitly unsubscribes.

You have passed any here, we can't figure out if it is an array or an object, so you're getting unknown. Use better types.

f
generate
deprecated

Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.

This function takes one parameter and just returns it. Simply put, this is like <T>(x: T): T => x.

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

Checks a boolean at subscription time, and chooses between one of two observable sources

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

Emits false if the input Observable emits any values, or emits true if the input Observable completes without emitting any values.

Tests to see if the object is an RxJS Observable

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

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.

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

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.

Merge the values from all observables to a single observable result.

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.

f
multicast
deprecated

An operator that creates a ConnectableObservable, that when connected, with the connect method, will use the provided subject to multicast the values from the source to all consumers.

f
never
deprecated

Re-emits all notifications from source Observable with specified scheduler.

f
pairs
deprecated

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

f
partition
deprecated
f
publish
deprecated

Returns a connectable observable that, when connected, will multicast all values through a single underlying Subject instance.

f
publishBehavior
deprecated

Creates a ConnectableObservable that utilizes a BehaviorSubject.

f
publishLast
deprecated

Returns a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.

f
publishReplay
deprecated

Creates a ConnectableObservable that uses a ReplaySubject internally.

Creates an Observable that mirrors the first source Observable to emit a next, error or complete notification from the combination of the Observable to which the operator is applied and supplied Observables.

f
refCount
deprecated

Make a ConnectableObservable behave like a ordinary observable and automates the way you can connect to it.

Returns an Observable that will resubscribe to the source stream when the source stream completes.

Returns an Observable that mirrors the source Observable with the exception of a complete. If the source Observable calls complete, this method will emit to the Observable returned from notifier. If that Observable calls complete or error, then this method will call complete or error on the child subscription. Otherwise this method will resubscribe to the source Observable.

Returns an Observable that mirrors the source Observable with the exception of an error. If the source Observable calls error, this method will resubscribe to the source Observable for a maximum of count resubscriptions (given as a number parameter) rather than propagating the error call.

Returns an Observable that mirrors the source Observable with the exception of an error. If the source Observable calls error, this method will emit the Throwable that caused the error to the Observable returned from notifier. If that Observable calls complete or error then this method will call complete or error on the child subscription. Otherwise this method will resubscribe to the source Observable.

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

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

Converts from a common ObservableInput type to an observable where subscription and emissions are scheduled on the provided scheduler.

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

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

Skip a specified number of values before the completion of an observable.

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

Asynchronously subscribes Observers to this Observable on the specified SchedulerLike.

Converts a higher-order Observable into a first-order Observable producing values only from the most recent observable sequence

Applies an accumulator function over the source Observable where the accumulator function itself returns an Observable, emitting values only from the most recently returned Observable.

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

Waits for the source to complete, then emits the last N values from the source, as specified by the count argument.

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

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

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

Creates an observable that will create an error instance and push it to the consumer as an error immediately upon subscription.

If the source observable completes without emitting a value, it will emit an error. The error will be created at that time by the optional errorFactory argument, otherwise, the error will be EmptyError.

Emits an object containing the current value, and the time that has passed between emitting the current value and the previous value, which is calculated by using the provided scheduler's now() method to retrieve the current time at each emission, then calculating the difference. The scheduler defaults to asyncScheduler, so by default, the interval will be in milliseconds.

If with is provided, this will return an observable that will switch to a different observable if the source does not push values within the specified time parameters.

f
timeoutWith
deprecated

If the time of the Date object passed arrives before the first value arrives from the source, it will unsubscribe from the source and switch the subscription to another observable.

Creates an observable that will wait for a specified time period, or exact date, before emitting the number 0.

Attaches a timestamp to each item emitted by an observable indicating when it was emitted

Collects all source emissions and emits them as an array when the source completes.

Creates an Observable that uses a resource which will be disposed at the same time as the Observable.

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

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

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

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.

Collects all observable inner sources from the source, once the source completes, it will subscribe to all inner sources, combining their values by index and emitting them.

Subscribes to the source, and the observable inputs provided as arguments, and combines their values, by index, into arrays.

Interfaces

A notification representing a "completion" from an observable. Can be used with dematerialize.

An observable with a connect method that is used to create a subscription to an underlying source, connecting it with all consumers via a multicast.

An object used to configure connect operator.

A notification representing an "error" from an observable. Can be used with dematerialize.

The global configuration object for RxJS, used to configure things like how to react on unhandled errors. Accessible via config object.

An observable of values that is the emitted by the result of a groupBy operator, contains a key property for the grouping.

An object that implements the Symbol.observable interface.

A notification representing a "next" from an observable. Can be used with dematerialize.

OBSERVER INTERFACES

I
Operator
deprecated

The base signature RxJS will look for to identify and use a ReadableStream as an ObservableInput source.

SCHEDULER INTERFACES

OBSERVABLE INTERFACES

A value emitted and the amount of time since the last value was emitted.

An error emitted when a timeout occurs.

A value and the time at which it was emitted.

This is a type that provides a method to allow RxJS to create a numeric timestamp

OPERATOR INTERFACES

SUBSCRIPTION INTERFACES

Type Aliases

Constructs a new tuple with the specified type at the head. If you declare Cons<A, [B, C]> you will get back [A, B, C].

A simple type to represent a gamut of "falsy" values... with a notable exception: NaN is "falsy" however, it is not and cannot be typed via TypeScript. See comments here: https://github.com/microsoft/TypeScript/issues/28682#issuecomment-707142417

Extracts the head of a tuple. If you declare Head<[A, B, C]> you will get back A.

Valid types that can be converted to observables.

Used to infer types from arguments to functions like forkJoin. So that you can have forkJoin([Observable<A>, PromiseLike<B>]): Observable<[A, B]> et al.

T
ObservableLike
deprecated

Valid observable notification types.

Extracts the type from an ObservableInput<any>. If you have O extends ObservableInput<any> and you pass in Observable<number>, or Promise<number>, etc, it will type as number.

Extracts a tuple of element types from an ObservableInput<any>[]. If you have O extends ObservableInput<any>[] and you pass in [Observable<string>, Observable<number>] you would get back a type of [string, number].

Extracts a union of element types from an ObservableInput<any>[]. If you have O extends ObservableInput<any>[] and you pass in Observable<string>[] or Promise<string>[] you would get back a type of string. If you pass in [Observable<string>, Observable<number>] you would get back a type of string | number.

Extracts the tail of a tuple. If you declare Tail<[A, B, C]> you will get back [B, C].

Extracts the generic value from an Array type. If you have T extends Array<any>, and pass a string[] to it, ValueFromArray<T> will return the actual type of string.

Gets the value type from an ObservableNotification, if possible.