DED|Chain Throttle
Throttling is used to map an array (or object) against a time threshold. This is useful when you want to run a timed action based on array elements.
Throttling is used to map an array (or object) against a time threshold. This is useful when you want to run a timed action based on array elements.
// throttle an array
$().throttle(2, ['dustin', 'vince', 'robert'], {
id: 'huzzah',
callback: function(needle) {
console.log(needle);
},
loop: true
});
// throttle an object
$().throttle(5, { name:'Dustin', sex:'Male', age: 26 }, {
id: 'blam',
callback: function(needle) {
console.log(needle);
},
onComplete: function() {
this.request(
},
loop: true
});
// stop a throttle by name
$().stopThrottle('blam');