Wondering what’s next for npm?Check out our public roadmap! »

    @thi.ng/rstream-csp
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.66 • Public • Published

    rstream-csp

    npm version npm downloads Twitter Follow

    This project is part of the @thi.ng/umbrella monorepo.

    About

    Adapter bridge between async CSP channels and synchronous stream subscriptions/transformations of @thi.ng/rstream.

    Status

    STABLE - used in production

    Search or submit any issues for this package

    Related packages

    • @thi.ng/csp - ES6 promise based CSP primitives & operations
    • @thi.ng/rstream - Reactive streams & subscription primitives for constructing dataflow graphs / pipelines

    Installation

    yarn add @thi.ng/rstream-csp
    // ES module
    <script type="module" src="https://unpkg.com/@thi.ng/rstream-csp?module" crossorigin></script>
    
    // UMD
    <script src="https://unpkg.com/@thi.ng/rstream-csp/lib/index.umd.js" crossorigin></script>

    Package sizes (gzipped, pre-treeshake): ESM: 251 bytes / CJS: 307 bytes / UMD: 422 bytes

    Dependencies

    API

    Generated API docs

    import * as rs from "@thi.ng/rstream";
    import * as tx from "@thi.ng/transducers";
    import { fromChannel } from "@thi.ng/rstream-csp";
    import { Channel } from "@thi.ng/csp";
    
    ch = new Channel();
    stream = fromChannel(ch);
    
    stream.subscribe(rs.trace("all"));
    stream.subscribe(rs.trace("only evens"), tx.filter(tx.even));
    
    ch.write(1);
    // all 1
    
    ch.write(2);
    // all 2
    // only evens 2
    
    stream.subscribe(rs.trace("tentimes"), tx.map(x => x * 10));
    // all 3
    // tentimes 30

    Authors

    Karsten Schmidt

    If this project contributes to an academic publication, please cite it as:

    @misc{thing-rstream-csp,
      title = "@thi.ng/rstream-csp",
      author = "Karsten Schmidt",
      note = "https://thi.ng/rstream-csp",
      year = 2018
    }

    License

    © 2018 - 2021 Karsten Schmidt // Apache Software License 2.0

    Install

    npm i @thi.ng/rstream-csp

    DownloadsWeekly Downloads

    84

    Version

    2.0.66

    License

    Apache-2.0

    Unpacked Size

    24 kB

    Total Files

    12

    Last publish

    Collaborators

    • avatar