Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created July 30, 2012 18:29
Show Gist options
  • Save cowboy/3208977 to your computer and use it in GitHub Desktop.
Save cowboy/3208977 to your computer and use it in GitHub Desktop.
for john k paul
var debounced = $.debounce(1000, orig);
var wrapper = function() {
// you have my permission to write whatever logic is useful to you here
if (arguments[0] === 'foo') {
orig.apply(null, arguments);
} else {
debounced.apply(null, arguments);
}
};
wrapper('foo', 'bar', 'baz'); // calls orig function
wrapper('omg', 'ponies'); // calls debounced function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment