@burmis/create-throttle
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Test Deno Module

create-throttle hook

This package contains a function you can use to create a throttle. Once a throttle is created you can call it passing in your own function to execute.

The throttle will execute your function immediately, and then wait for interval to complete before resolving. This allows you to limit the number of times a function is called in a given interval.

Example Usage

const throttle = createThrottle({
  limit: 3, // number of calls allowed in the interval
  interval: 100, // in milliseconds
});

await throttle(async () => console.log("Test Function 1")); // This will be called immediately
await throttle(async () => console.log("Test Function 2")); // This will be called immediately
await throttle(async () => console.log("Test Function 3")); // This will be called immediately
await throttle(async () => console.log("Test Function 4")); // This will be called after the 100ms interval has passed

Running Tests

deno task check

Publishing to NPM

deno task publish

Other Tasks

Run this command to print out all available tasks.

deno task

Note: In order to publish an update or new version, you must increment VERSION within version.ts in the root directory.

export const VERSION = x.x.x; // Increment me accordingly

Readme

Keywords

none

Package Sidebar

Install

npm i @burmis/create-throttle

Weekly Downloads

39

Version

0.0.4

License

MIT

Unpacked Size

6.32 kB

Total Files

8

Last publish

Collaborators

  • nashtronaut
  • markbennett