MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / throttle

Method throttle

src/utils.ts:543–551  ·  view source on GitHub ↗

delay calling the given function for given delay, preventing new calls from happening while waiting

(func: () => void, delay: number)

Source from the content-addressed store, hash-verified

541
542 /** delay calling the given function for given delay, preventing new calls from happening while waiting */
543 static throttle(func: () => void, delay: number): () => void {
544 let isWaiting = false;
545 return (...args) => {
546 if (!isWaiting) {
547 isWaiting = true;
548 setTimeout(() => { func(...args); isWaiting = false; }, delay);
549 }
550 }
551 }
552
553 static removePositioningStyles(el: HTMLElement): void {
554 const style = el.style;

Callers 2

_updateResizeEventMethod · 0.80
utils-spec.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected