mail/push-to-talk-extension/utils.js

13 lines
267 B
JavaScript
Raw Permalink Normal View History

2024-05-03 12:40:35 +03:00
export function throttle(fn, delay) {
let timeout = null;
return function (...args) {
if (timeout === null) {
fn(...args);
timeout = setTimeout(() => {
timeout = null;
}, delay);
}
};
}