Debian Codegraph @

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

raw
1 export function throttle(fn, delay) {
2 let timeout = null;
3
4 return function (...args) {
5 if (timeout === null) {
6 fn(...args);
7 timeout = setTimeout(() => {
8 timeout = null;
9 }, delay);
10 }
11 };
12 }