UNPKG

@pmwcs/base

Version:
15 lines (13 loc) 329 B
export const debounce = function (func, wait) { let timeout; return function () { const context = this; const args = arguments; const later = function () { timeout = null; func.apply(context, args); }; timeout !== null && clearTimeout(timeout); timeout = setTimeout(later, wait); }; };