Similar to debounce/throttle, but callbacks will be added to queue and called with provided interval. First callback call is invoked immediately. Note, last callback call wont cause timeout and prevent process from exiting immediately.
Install
$ npm i --save interval-actions
Usage
const {interval} = require; const logWithInterval = interval; console.time; logWithInterval; // time: 0.405mslogWithInterval; // time: 1005.094mslogWithInterval; // time: 2006.982ms
Api
param | type | description |
---|---|---|
fn |
Function | callback function |
time |
number | interval duration in ms |