mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-05-24 14:53:45 +00:00
13 lines
257 B
JavaScript
13 lines
257 B
JavaScript
const debounce = (callback, wait) => {
|
|
let timeout;
|
|
|
|
return (...args) => {
|
|
window.clearTimeout(timeout);
|
|
timeout = window.setTimeout(() => {
|
|
timeout = null;
|
|
callback.apply(this, args);
|
|
}, wait);
|
|
};
|
|
};
|
|
|
|
export default debounce;
|