jsinterval
TypeScript icon, indicating that this package has built-in type declarations

5.1.1 • Public • Published
ISC License NPM Version

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 keithbrown39423@outlook.com or make an issue on GitHub

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i jsinterval

Weekly Downloads

1

Version

5.1.1

License

MIT

Unpacked Size

4.49 kB

Total Files

5

Last publish

Collaborators

  • keithbrown39423