Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/stream_observables/transforms/mod.ts>subchain

A collection of observables built with ReadableStreams & friends.
Latest
function subchain
import { subchain } from "https://deno.land/x/stream_observables@v1.3/transforms/mod.ts";

Returns a Transform that applies f to the observable.

Examples

subchain() can be used to create logical groups in a longer chain or to make parts of a chain reusable.

ows
  .fromEvent(button, "click")
  .pipeThrough(
    ows.subchain(o =>
      o
        .pipeThrough(ows.map(() => fetch("/stockData")))
        .pipeThrough(ows.map(r => r.json()))
        .pipeThrough(ows.filter(data => data.tags.contains(importTag)))
    )
  )
  .pipeTo(
    ows.discard(data => {
      // ...
    })
  );

Parameters

f: (x: Observable<S>) => Observable<T>

Function that will be applied to the observable.

Returns

Transform that applies f to the observable.