Files
SpotMicroESP32-Leika/app/src/lib/utilities/buffer-utilities.ts
T
2024-02-22 23:45:36 +01:00

17 lines
378 B
TypeScript

export class throttler {
private _throttlePause: boolean;
constructor() {
this._throttlePause = false;
}
throttle = (callback:Function, time:number) => {
if (this._throttlePause) return;
this._throttlePause = true;
setTimeout(() => {
callback();
this._throttlePause = false;
}, time);
};
}