@elvis/fetch-loop@1.0.3
latest
Simple abstraction over fetch to only permit a certain amount of requests per time interval.
This package works with Node.js, BrowsersIt is unknown whether this package works with Cloudflare Workers, Deno, Bun




JSR Score
70%
Published
a year ago (1.0.3)
fetch-loop
Simple abstraction over fetch
to only allow a certain amount of requests per interval of time.
API
FetchLoop
provides a simple API over the browser fetch
function that allows only a certain
amount of requests per interval of time.
import { FetchLoop } from "fetch-loop"; const fl = new FetchLoop({ intervalMilliseconds: 5_000, requestsPerInterval: 2, }); for (let i = 10; i; i--) { fl.fetch(`https://jsonplaceholder.typicode.com/todos/${i}`) .then((response) => response.json()) .then((json) => console.log(json)); }
Add Package
deno add jsr:@elvis/fetch-loop
Import symbol
import * as fetch_loop from "@elvis/fetch-loop";
Import directly with a jsr specifier
import * as fetch_loop from "jsr:@elvis/fetch-loop";
Add Package
pnpm i jsr:@elvis/fetch-loop
pnpm dlx jsr add @elvis/fetch-loop
Import symbol
import * as fetch_loop from "@elvis/fetch-loop";
Add Package
yarn add jsr:@elvis/fetch-loop
yarn dlx jsr add @elvis/fetch-loop
Import symbol
import * as fetch_loop from "@elvis/fetch-loop";
Add Package
vlt install jsr:@elvis/fetch-loop
Import symbol
import * as fetch_loop from "@elvis/fetch-loop";
Add Package
npx jsr add @elvis/fetch-loop
Import symbol
import * as fetch_loop from "@elvis/fetch-loop";
Add Package
bunx jsr add @elvis/fetch-loop
Import symbol
import * as fetch_loop from "@elvis/fetch-loop";