Files
ETB/ETB-FrontEnd/node_modules/@mui/x-internals/throttle/throttle.js
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

25 lines
498 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.throttle = throttle;
function throttle(func, wait = 166) {
let timeout;
let lastArgs;
const later = () => {
timeout = undefined;
func(...lastArgs);
};
function throttled(...args) {
lastArgs = args;
if (timeout === undefined) {
timeout = setTimeout(later, wait);
}
}
throttled.clear = () => {
clearTimeout(timeout);
timeout = undefined;
};
return throttled;
}