Skip to main content

Built and signed on GitHub Actions

Manipulate Web Streams with Reactive Programming concepts. Deno-first, works elsewhere as well.

This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
100%
Published
5 months ago (1.4.0)

This module is a Deno-friendly port of observables-with-streams.

Published to jsr.io as @cloudydeno/stream-observables. Read more about using packages.

Published to /x/ as stream_observables. Import from https://deno.land/x/stream_observables@v1.3/.

Subset of original README below:

Observables with Streams

A library for observables built with WHATWG streams. This library is inspired by ReactiveX’s operators and implements a subset of them using streams.

The goal of this library is to implement observables making as much use of the platform as possible and being highly tree-shakeable.

Example

import * as ows from "jsr:@cloudydeno/stream-observables@^1.4.0";

console.log('Tap Enter to add energy!');
ows.merge(
  ows.fromTimer(500)
    .pipeThrough(ows.map(() => -1)),
  ows.fromDenoReader(Deno.stdin)
    .pipeThrough(ows.map(() => 1)),
)
  .pipeThrough(
    ows.scan((v0, v1) => Math.max(v0 + v1, 0), 0)
  )
  .pipeThrough(
    ows.distinct()
  )
  .pipeTo(
    ows.subscribe(
      v => console.log('Energy:', v)
    )
  );

Documentation

The (somewhat lacking) documentation for the original library is hosted at https://observables-with-streams.surma.technology

Caveats

For a good primer about streams, read this blog post by Jake Archibald (he is aware the title hasn’t aged well).


License Apache 2.0

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@cloudydeno/stream-observables

Import symbol

import * as stream_observables from "@cloudydeno/stream-observables";

---- OR ----

Import directly with a jsr specifier

import * as stream_observables from "jsr:@cloudydeno/stream-observables";

Add Package

npx jsr add @cloudydeno/stream-observables

Import symbol

import * as stream_observables from "@cloudydeno/stream-observables";

Add Package

yarn dlx jsr add @cloudydeno/stream-observables

Import symbol

import * as stream_observables from "@cloudydeno/stream-observables";

Add Package

pnpm dlx jsr add @cloudydeno/stream-observables

Import symbol

import * as stream_observables from "@cloudydeno/stream-observables";

Add Package

bunx jsr add @cloudydeno/stream-observables

Import symbol

import * as stream_observables from "@cloudydeno/stream-observables";