0.1.0 • Published 8 years ago
set-variable-interval v0.1.0
set-variable-interval
Install
npm i set-variable-intervalUsage
const clearFn = setVariableInterval(fn, intervalFn, ...params)fn[function]Code to executeintervalFn[function]Function to provide the next interval to be used(last) => { return (/*next*/) }lastLast return value of this functionMust return a value to be used as next interval
paramsParams passed tofn(returns)clearFn[function]To clear the interval
Example
const setVariableInterval = require('set-variable-interval');
const clear = setVariableInterval(() => {
console.log(new Date().split('T')[1]);
}, (i = 0) => i + 200);00:00:00.000Z
00:00:00.200Z
00:00:00.600Z
00:00:01.200Z
00:00:02.000Z
00:00:03.000Z
00:00:04.200Z
00:00:05.600Z
...0.1.0
8 years ago