@cfware/cleanable-interval

0.1.4 • Public • Published

@cfware/cleanable-interval NPM Version

A variant of setInterval that returns a cleanup function.

Usage

import cleanableInterval from '@cfware/cleanable-interval';

let iter = 0;
const cleanupFn = cleanableInterval(() => {
	iter++;
	console.log(`Iteration ${iter} of 2`);
	if (iter > 1) {
		cleanupFn();
	}
}, 100);

Readme

Keywords

none

Package Sidebar

Install

npm i @cfware/cleanable-interval

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

3.81 kB

Total Files

5

Last publish

Collaborators

  • coreyfarrell