promise-throttle (master) doxdox documentation

A library to throttle promises

# PromiseThrottle(options, requestsPerSecond)

Parameters

Name Types Description
options Object A set op options to pass to the throttle function
requestsPerSecond number The amount of requests per second the library will limit to

# PromiseThrottle._execute()

private method

Executes the promise

Returns

void

# PromiseThrottle.add(promise, options, options.signal, options.weight)

Adds a promise

Parameters

Name Types Description
promise Function A function returning the promise to be added
options Object A set of options.
options.signal number An AbortSignal object that can be used to abort the returned promise
options.weight number A "weight" of each operation resolving by array of promises

Returns

Promise

A promise

# PromiseThrottle.addAll(promises, options, options.signal, options.weight)

Adds all the promises passed as parameters

Parameters

Name Types Description
promises Function An array of functions that return a promise
options Object A set of options.
options.signal number An AbortSignal object that can be used to abort the returned promise
options.weight number A "weight" of each operation resolving by array of promises

Returns

Promise

A promise that succeeds when all the promises passed as options do

# PromiseThrottle.dequeue()

Dequeues a promise

Returns

void