UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

14 lines (12 loc) 217 B
export function throttle(fn, ms){ let wait = false return function (...input){ if (!wait){ fn.apply(null, input) wait = true setTimeout(() => { wait = false }, ms) } } }