set-harmonic-interval

set-harmonic-interval

Works similar to setInterval, but calls all callbacks scheduled using setHarmonicInterval all at once, which have same delay in milliseconds.

Install

npm install set-harmonic-interval

Usage

In below example 1 and 2 will always be printed together every second.

const { setHarmonicInterval, clearHarmonicInterval } = require('set-harmonic-interval');

setHarmonicInterval(() => console.log(1), 1000);
setTimeout(() => {
  setHarmonicInterval(() => console.log(2), 1000);
}, 500);

License

Unlicense — public domain.

HomePage

https://github.com/streamich/set-harmonic-interval

Repository

streamich/set-harmonic-interval


上一篇:custom-guider
下一篇:ts-easing

公众号

欢迎 JavaScript 爱好者