Skip to content

Instantly share code, notes, and snippets.

@stevenpray
Created December 20, 2017 15:13
Show Gist options
  • Save stevenpray/415fede6a688fcf9a1ae0b29095a1290 to your computer and use it in GitHub Desktop.
Save stevenpray/415fede6a688fcf9a1ae0b29095a1290 to your computer and use it in GitHub Desktop.
'use strict';
function debounce(func, wait) {
let timeout
return function (...args) {
const _this = this
clearTimeout(timeout)
timeout = setTimeout(() => func.apply(_this, args), wait)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment