Skip to main content
Module

x/stream_observables/mod.ts

A collection of observables built with ReadableStreams & friends.
Latest
import * as streamObservables from "https://deno.land/x/stream_observables@v1.3/mod.ts";

Variables

Symbol indicating the end of a stream. Used with external.

Functions

Takes in multiple observables but only emits items from the first observable to emit.

Collects items from the original observable into buffers until the notifier emits. If no items have been buffered since the last time the notifier emitted, nothing will be emitted. Closing the emitter will emit the remaining buffer.

Collects items from the original observable into buffers of size count.

Collects all values from the observable into an array.

Combines items from multiple observables. The resulting observable emits array tuples whenever any of the given observables emit, as long as every observable has emitted at least once. The tuples contain the last emitted item from each observable.

Combines items from the original observable with the other observables. See combineLatest.

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

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

Returns a Transform where items are only emitted if ms milliseconds pass without new a new emit by the source observable. If a new value is emitted, the “cooldown” is restarted and the old value is discarded.

Sink for observables that discards all values. Useful to leave at the end of a chain.

Returns a Transform where all subsequent repetitions of the same item are filtered out.

Returns a Transform that emits the items specified as arguments after te source observable ends.

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

Utility function to create new observables from external sources. Returns an object with two values: the new observable, and a next function which will emit a value to observable when called. Calling next with EOF will indicate there are no more values to emit.

Resolves with the first element emitted by the observable, then releases the observable. If no items are emitted the promise is rejected.

Resolves with the last element emitted by the observable. If no items are emitted the promise is rejected.

Returns a Transform that emits all items for which f returns true.

Returns a Transform that emits the first item in an observable. The source observable will be drained after.

Calls a function for each item emitted by an observable without waiting for the function to return to forward the item. Exceptions thrown by the function will be caught and ignored.

When all observables complete, emit the last emitted value from each.

Creates an observable from an asynchronous function. The observable emits exactly one value when once the function returns.

Create a ReadableStream<Uint8Array> from from a Deno.Reader.

Creates an observable from an EventTarget. Each event is turned into an item for the observable.

Creates an observable from a generator that takes no arguments.

Create a ReadableStream from any kind of iterable.

Creates an observable from a function that gets passed the observable's next() function.

Creates an observable from a promise, that emits exactly one value when the promise resolves.

Creates an observable that will forever emit null every ms milliseconds.

Creates an observable that emits a set of values.

Returns a Transform that emits the last item in an observable.

Returns a Transform with the results of applying the given function to each emitted item of the original observable.

Merges multiple observables by emitting all items from all the observables. Items are emitted in the order they appear.

Merges another observable by emitting all items from both the original observable and the other observable. Items are emitted in the order they appear.

An alias for just.

Alias for amb.

Creates an observable that emits numbers from start to end.

Accumulates value, starting with v0 and applying f to each emitted item. If no items are emitted the promise is rejected.

Creates an observable that forever emits the same value.

Emits the most recently emitted value from the Observable whenever the notifier emits. If no new value has been emitted from the source observable since the last time the notifier emitted, nothing will be emitted.

Reduces the original observable with f, emitting every intermediate result not including the initial value.

Resolves with the only element emitted by the observable. If zero or more than one items are emitted, the promise is rejected.

Returns a Transform that applies f to the observable.

Alias for discard.

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

Converts each emitted item to an observable, producing values only from the most recent observable in the sequence.

Returns a Transform that emits the first n items from the original observable.

Returns a Transform that emits items from the original observable until f returns false.

Alias for forEach.

Branches out the source observable as nested observables whenever notifier emits.

Zips items from multiple observables. The resulting observable emits items as array tuples.

Zips items from the original observable with the other observable. See zip.

Type Aliases

An Observable in the sense of ReactiveX. The signature, however, does not match the one precedented in ReactiveX and other languages. In its current incarnation, Observables are synonymous with WHATWG ReadableStream.