Skip to content

Instantly share code, notes, and snippets.

@megawac
Created June 29, 2015 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megawac/4ccd381fbec1950d1b92 to your computer and use it in GitHub Desktop.
Save megawac/4ccd381fbec1950d1b92 to your computer and use it in GitHub Desktop.
log if debounce isn't called
function hackyDebounce(func, wait, options) {
var called = false;
var debounced = _.debounce(function() {
called = true;
func.apply(this, arguments);
}, wait, options);
return function() {
debounced.apply(this, arguments);
if (!called) {
console.log("It wasn't called");
}
called = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment