0.1.74 • Published 6 years ago

@allforabit/rstream-csp v0.1.74

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 years ago

@thi.ng/rstream-csp

npm (scoped)

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.

Installation

yarn add @thi.ng/rstream-csp

Dependencies

Usage examples

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

License

© 2018 Karsten Schmidt // Apache Software License 2.0