UNPKG

rambdax

Version:

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

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