资源介绍
变更间隔
更改节点的setInterval
您是否曾经想过要更改延迟的间隔,现在可以了。
原料药
var changingInterval = require('changing-interval');
var interval = changingInterval(function(){
// This will be called every interval
// Code goes here
console.log('Called');
}, function(){
// this should return the interval
return (Math.random() * 10) * 1000;
// return null or undefined or false to stop the interval
})
// To clear in