🪖 Moves throttle to utilities folder

This commit is contained in:
Rune Harlyk
2024-02-22 23:45:36 +01:00
parent 1536fe1c50
commit 74bf4a8656
2 changed files with 2 additions and 1 deletions
+16
View File
@@ -0,0 +1,16 @@
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);
};
}