@jagi/set-interval-time-fn
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

@jagi/set-interval-time-fn

Example usage

import {
  setIntervalTimeFn,
  clearIntervalTimeFn,
} from "@jagi/set-interval-time-fn";

const start = Date.now();

const timerId = setIntervalTimeFn(
  () => {
    console.log(`${Date.now() - start} ms elapsed`);
  },
  time => {
    // Start interval from 1 second and increase it by 1 second on each execution.
    return !time ? 1000 : time + 1000;
  },
);

setTimeout(() => {
  clearIntervalTimeFn(timerId);
}, 10 * 1000); // Clear interval after 20 seconds.

Readme

Keywords

none

Package Sidebar

Install

npm i @jagi/set-interval-time-fn

Weekly Downloads

0

Version

0.1.3

License

none

Unpacked Size

2.78 kB

Total Files

7

Last publish

Collaborators

  • lukejagodzinski