Sha256: 4e99ab2d265464f05b4adfecebb311a681acdc99b79f17f753a57fd4867af493
Contents?: true
Size: 510 Bytes
Versions: 3
Compression:
Stored size: 510 Bytes
Contents
// Usage: // ``` // const basicFunction = (entry) => console.log(entry) // const debounced = debounce(basicFunction("I should only be called once")); // // debounced // does NOT print to the screen because it is invoked again less than 200 milliseconds later // debounced // does print to the screen // ``` export default function debounce(func, timeout = 200) { let timer; return (...args) => { clearTimeout(timer); timer = setTimeout(() => { func.apply(this, args); }, timeout); }; }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blacklight-8.8.2 | app/javascript/blacklight/debounce.js |
blacklight-8.8.1 | app/javascript/blacklight/debounce.js |
blacklight-8.8.0 | app/javascript/blacklight/debounce.js |