aboutsummaryrefslogblamecommitdiff
path: root/src/debounce.js
blob: 02f1a1a56bb9b256a5f4f674db5151177a0e4f57 (plain) (tree)
1
2
3
4
5
6
7
8







                                                               
export default function debounce (func, wait) {
  let timeout
  return function (...args) {
    const context = this
    clearTimeout(timeout)
    timeout = setTimeout(() => func.apply(context, args), wait)
  }
}