« »
3/17/2011

jQuery-debounceargs - Debounce call while saving each arguments

jQuery DeboungeArgs helps you debounce function call while saving arguments. In an RIA environment it may be useful if you want to group http requests to the database.

var myFunction = function(dataArray){
// Do something with these data (ajax ?)
console.log('Debounced arguments:', dataArray);
}
var myDebouncedFunction = $.debounceargs(5000, myDebouncedFunction);
myDebouncedFunction({model:'post', action:'save', data:[1,2,3,4]});
myDebouncedFunction({model:'comment', action:'add', data:{text:'hello world', author:'anonymous'}});
// Wait 5secs and firebug/inspector should print something like this:
[[Object { model="post", action="save", data=}], [Object { model="comment", action="add", data=String}]]


« »
 
 
Made with on a hot august night from an airplane the 19th of March 2017.