@embrace-io/web-sdk
Version:
11 lines • 714 B
TypeScript
//#region src/utils/throttle.d.ts
/** throttle wraps a function so it can only be called once, and then a time window must pass before it can be called again
* any subsequent calls before the time window has passed will be ignored.
*
* NOTE: if the wrapped function makes use of "this", it must be properly bind from the caller, as this wrapper will not bind it.
* For this, we suggest you always pass functions declared as fat arrow functions, as they have their "this" lexically defined.
* */
declare const throttle: <F extends (...args: Parameters<F>) => ReturnType<F>>(func: F, timeout?: number) => (...args: Parameters<F>) => void;
//#endregion
export { throttle };
//# sourceMappingURL=throttle.d.ts.map