1
0

debounce.js 246 B

1234567891011
  1. export function debounce (fn, delay) {
  2. var timeoutID = null
  3. return function () {
  4. clearTimeout(timeoutID)
  5. var args = arguments
  6. var that = this
  7. timeoutID = setTimeout(function () {
  8. fn.apply(that, args)
  9. }, delay)
  10. }
  11. }