channels-js
A Pure JS implentation of channels with async/await
Types
* * // Needs Buffersize in constructor * // Unlimited Buffersize | never blocks write
Usage
let channels = ; let UnBufferedChannel = ; async fucntion { await UnBufferedChannel; } { let data = await UnBufferedChannel; //Do Something with Data... } ; ;
Alternate Way to read until nothing wants to write
channels-js now supports Async Iterators[ for await (... of ...) ]
let channel = channelsAny of the 3 Types; { for { // Do Something with data ... } }
More Examples
let channels = ; let BufferedChannel = 10; { whiletrue await BufferedChannel; // Blocks only after internal Buffer is fulf } { let data = await UnBufferedChannel; //Do Something with Data... } ; ;