blob: 5cf145351b3490f16b9fd6beea4e8d7c4739c757 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
const debounce = (fn, time) => {
let current;
const debounced = () => {
if (current) {
clearTimeout(current);
}
current = setTimeout(fn, time);
};
return debounced;
};
export default debounce;
|