The function to invoke at the limited rate.
The bucket capacity (max burst) and refill interval.
A callback that queues-and-limits invocations of inner, with reset
and dispose handles. dispose cancels any queued calls and prevents further
invocation.
Rate-limits invocations with a token bucket. The bucket holds up to RateLimitOptions.capacity tokens and refills one token every RateLimitOptions.interval seconds. Each call consumes a token and runs immediately; a call made while the bucket is empty is queued and invoked as tokens refill (in call order).
Unlike throttle, which drops calls that arrive within its window,
rateLimitnever drops a call — it only delays the ones that exceed the rate. A full bucket allows an initial burst ofcapacitycalls.