UNPKG

@pmwcs/base

Version:
14 lines (13 loc) 318 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) } }