jsinterval
v5.1.1
Published
JSInterval is a JavaScript library that makes working with intervals easier.
Downloads
4
Readme
JSInterval
Description
JSInterval is a JavaScript library that makes working with intervals easier. It has a simple API and can be used in both Node.js and the browser
Credit
This project makes use of vercel/ms
Installation
Install JSInterval with npm
npm install jsinterval
Features
- Works in both Node.js and in the browser
- Uses ms (Node.js only) to allow strings such as "1 minute", "30s", etc.
Usage/Examples
HTML
<script src="https://cdn.jsdelivr.net/gh/KeithBrown39423/JSInterval/index.js">
<script>
const timer = new Interval({
func: () => {
console.log(Date.now());
},
delay: 1000
});
</script>
JavaScript / TypeScript
const Interval = require("jsinterval");
// TypeScript: import Interval from "jsinterval"; with --esModuleInterop
// TypeScript: import * as Interval from "jsinterval"; with --allowSyntheticDefaultImports
// TypeScript: import Interval = require("jsinterval"); with neither of the above
const timer = new Interval({
func: () => {
console.log(Date.now());
},
delay: "1 Second"
});
Support
For support, email [email protected] or make an issue on GitHub