UNPKG

alpinejs

Version:

The rugged, minimal JavaScript framework

17 lines (11 loc) 303 B
export function throttle(func, limit) { let inThrottle return function() { let context = this, args = arguments if (! inThrottle) { func.apply(context, args) inThrottle = true setTimeout(() => inThrottle = false, limit) } } }