This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}]] |