UNPKG

rafa

Version:

Rafa.js is a Javascript framework for building concurrent applications.

24 lines (18 loc) 584 B
Subscribe to an enumerator and emit its values through the stream. This is a concurrent iteration: the stream will not ask for the enumerator's next value until it is done processing the previous value. And the enumerator will not provide a new value to the stream until it has one. <aside> ```js // enumerate(Enumerator): Stream var stream = Rafa.stream(); var results = { vals: [] }; stream. .each(v => results.vals.push(v)) .done(v => results.last = v); stream.enumerate(Rafa.Enumerator.array([1,2,3,4]); // results: // - vals: [1, 2, 3, 4] // - last: 4 ``` </aside>