Simple implementation of a Promises/A+ queue module.
Exports a single function that creates a new queue, and can be passed a configuration object with the following keys:
concurrency
: The maximum number of concurrently-executing functions. (Default:1
)Promise
: Promise constructor. (Default:global.Promise
)
The return value is the enqueue function, which accepts a single function as its argument. It will return a promise for the result of that function. The function is considered executing until this promise resolves; that is, if the function returns a promise, it will still be considered executing until that promise is settled.