A small library to throttle promises. Useful to avoid rate limiting when using REST APIs.
Fix add
and addAll
TypeScript typings (#83). Thanks @draperunner!
This update adds Typescript typings to the list of files in the package #77. Thanks @draperunner for contributing!
This update adds Typescript typings to the library https://github.com/JMPerez/promise-throttle/pull/76. Thanks @IlyaSemenov for contributing!
This update contains upgrades in outdated dependencies that solve known vulnerabilities in packages.
This version adds a signal
parameter that allows the cancellation or abort operation of one or several queued promises. This is similar to the mechanism by which a fetch()
request can be aborted using AbortController.
Note about upgrading to version 1.0.0
If you were using the weight
option, you will need to pass it as a property in the options
object.
pt.add(..., 2 /* weight*/);
becomes
pt.add(..., {weight: 2});
this is so we can accommodate new options like signal
.
Added a weight
parameter to consider that a certain promise counts more towards the rate limit.
Thanks @pldin601 for your contribution!
When installing this package as a dependency it will now not include unneeded files like tests or linting configuration, thus reducing the size of the dependency to the bare minimum.
This version makes a non-breaking change to the addAll()
method, which now returns a Promise
itself. This change was proposed and implemented by @mawrkus. Big kudos to him and thanks for contributing!
The development, testing and reporting flow has also been simplified and improved.