@channel/limitersdeprecated

Basic async iterators for limiting concurrency, implemented with channels

Usage no npm install needed!

<script type="module">
  import channelLimiters from 'https://cdn.skypack.dev/@channel/limiters';
</script>

README

@channel/limiters

This package is experimental!

Basic async iterators for limiting concurrency, implemented with channels

For more information, visit channel.js.org.

interface Token {
  readonly id: number;
  readonly limit: number;
  readonly remaining: number;
  release(): void;
}

function semaphore(limit: number): Channel<Token>;

interface ThrottleToken extends Token {
    readonly reset: number;
}

function throttler(wait: number, options?: {
    limit?: number;
    cooldown?: boolean;
}): Channel<ThrottleToken>;