Async Iterator Extensions
A library of async iterator extensions for JavaScript
Installation
npm install aix # or yarn install aix
Why Aix?
Async iterators are a useful way to handle asynchronous streams. This library adds a number of utility methods similar to those found in lodash, underscore or Ramda.
Examples
fromEvents
fromEvents
turns DOM events into an iterable.
; const clicks = ; for { console;}
DeferredIterable
DeferredIterable
makes it easy to turn stream of events into an iterable. The code below
is essentially how fromEvents
was implemented.
; const deferredIterable = ; // set up a callback that calls value on the deferredIterableconst callback = deferredIterablevaluevalue; // attach the callback to the click eventdocument; // remove the callback when / if the iterable stopsdeferredIterable; // go through all the click eventsfor { console;}