UNPKG

@fine-js/channels

Version:

Bits of Clojure's `core.async` ported to JS

37 lines (24 loc) 1.19 kB
# Changelog ## Version `0.0.2` from May 16, 2020 A build for browsers is available. Read more [here](README.md#browsers). ## Version `0.0.1` from April 26, 2020 First release published to [npm](https://www.npmjs.com/package/@fine-js/channels) with base functionality: ###### Basics - `chan()` creates a channel - `put()` puts a value onto the channel - `take()` takes a value from the channel - `close()` closes a channel ###### Core - `alt()` runs at most one of the given operations returning result of handler - `alts()` runs at most one of the given ports - `poll()` takes a value from channel, when immediately possible - `offer()` puts a value onto channel, when immediately possible - `timeout()` creates a self-closing channel ###### Buffers - `unbuffered()` for directly connecting writers to readers - `buffer()` up to given capacity - `dropping()` ignores writes over capacity - `sliding()` writes over capacity remove oldest written value ###### JavaScript Extras - `ch[Symbol.asyncIterator]` makes channel iterable with [`for await…of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of)