|
// Function to mimic lodash throttle
|
|
export default function throttle(func, limit) {
|
|
let inThrottle;
|
|
return function (...args) {
|
|
const context = this;
|
|
if (!inThrottle) {
|
|
func.apply(context, args);
|
|
inThrottle = true;
|
|
setTimeout(() => (inThrottle = false), limit);
|
|
}
|
|
};
|
|
}
|