Skip to content

🕵️ Limit the amount of times that setInterval will fire

License

Notifications You must be signed in to change notification settings

UltiRequiem/six

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

six

codecov deno doc

Set Interval X

Limit the amount of times that setInterval will fire.

Made for this StackOverflow Question 😆

Usage

import { setIntervalX } from "https://deno.land/x/six/mod.ts";
import { randomNumber } from "https://deno.land/x/random_number/mod.ts";

const API_URL = "https://leap.deno.dev";

async function checkAPIStatus() {
  const startTime = performance.now();

  const randomYear = randomNumber({ min: 2000, max: 10_000 });

  const response = await fetch(`${API_URL}/${randomYear}`);

  const data = await response.json();

  console.log(`Is ${randomYear} a leap year? ${data.leapYear}.`);

  const entTime = performance.now();

  console.log(`Request took ${(entTime - startTime) / 1000} seconds.`);
}

setIntervalX(checkAPIStatus, 2000, 15);
import { setIntervalX } from "@ultirequiem/six";

You can use any CDN 🔥

Eg. ESMSkyPack / script tagJSDelivr.

The API is the same on all this platforms.

API

Autogenerated Documentation 🚀

Support

Open an Issue, I will check it a soon as possible 👀

If you want to hurry me up a bit send me a tweet 😆

Consider supporting me on Patreon if you like my work 🚀

Don't forget to start the repo ⭐

Versioning

We use SemVer for versioning. For the versions available, see the tags.

Authors

Eliaz Bobadilla (a.k.a UltiRequiem) - Creator and Maintainer 💪

See also the full list of contributors who participated in this project.

Licence

Released under the MIT Licence.

About

🕵️ Limit the amount of times that setInterval will fire

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors 2

  •  
  •