Skip to main content
Home

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
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
70%
Published
a year ago (1.0.3)

fetch-loop

NPM version

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));
}

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@elvis/fetch-loop

Import symbol

import * as fetch_loop from "@elvis/fetch-loop";
or

Import directly with a jsr specifier

import * as fetch_loop from "jsr:@elvis/fetch-loop";

Add Package

pnpm i jsr:@elvis/fetch-loop
or (using pnpm 10.8 or older)
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
or (using Yarn 4.8 or older)
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";