scrivito
Version:
Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.
17 lines (13 loc) • 403 B
text/typescript
import doThrottle, { ThrottleSettings } from 'lodash-es/throttle';
let throttleDisabled = false;
export function throttle<T extends (...args: unknown[]) => void>(
fn: T,
ms: number,
options?: ThrottleSettings
): T {
return throttleDisabled ? fn : (doThrottle(fn, ms, options) as unknown as T);
}
// For test purpose only
export function disableThrottle(): void {
throttleDisabled = true;
}