Created
March 17, 2011 18:30
-
-
Save FGRibreau/874862 to your computer and use it in GitHub Desktop.
jQuery-debounceargs
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}]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment