Files
parcer/src/helpers/inputHelpers.ts
2024-06-14 22:28:29 +05:30

22 lines
438 B
TypeScript

import {
ONE_PERCENT_OF_VIEWPORT_H,
ONE_PERCENT_OF_VIEWPORT_W,
VIEWPORT_W,
VIEWPORT_H,
} from "../constants/const";
import { Coordinates } from '../components/atoms/canvas';
export const throttle = (callback: any, limit: number) => {
let wait = false;
return (...args: any[]) => {
if (!wait) {
callback(...args);
wait = true;
setTimeout(function () {
wait = false;
}, limit);
}
}
}