Skip to content

Instantly share code, notes, and snippets.

@sairion
Last active April 22, 2016 15:43
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 sairion/01b1069c7b02db6f074ebe116f411b1e to your computer and use it in GitHub Desktop.
Save sairion/01b1069c7b02db6f074ebe116f411b1e to your computer and use it in GitHub Desktop.
keyboard event type (i.e. keyword-based recommendation)
export function debounceUntilTimeout(fun, delay, context = null) {
var timer;
return function delayedFunctionWrapper(...args) {
clearTimeout(timer);
args.unshift(context);
timer = setTimeout(fun.bind.apply(fun, args), delay);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment