MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / debounce

Function debounce

src/utils/helpers.js:362–372  ·  view source on GitHub ↗

* Creates a debounced function that delays invoking the input function until after 'wait' milliseconds have elapsed * since the last time the debounced function was invoked. Useful for implementing behavior that should only happen * after the input is complete. * * @param {Function} func - T

(func, wait)

Source from the content-addressed store, hash-verified

360 * window.addEventListener('resize', debounce(myFunction, 200));
361 */
362 debounce(func, wait) {
363 let timeout;
364 return function debounced(...args) {
365 const later = () => {
366 clearTimeout(timeout);
367 func.apply(this, args);
368 };
369 clearTimeout(timeout);
370 timeout = setTimeout(later, wait);
371 };
372 },
373 defineDeprecatedProperty(obj, name, getter, setter) {
374 Object.defineProperty(obj, name, {
375 get: function () {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected