UNPKG

@arco-design/web-vue

Version:

Arco Design Vue 2.0: A Vue.js 3 UI Library

15 lines (14 loc) 322 B
const target = typeof window === "undefined" ? global : window; function debounce(callback, delay) { let timer = 0; return (...args) => { if (timer) { target.clearTimeout(timer); } timer = target.setTimeout(() => { timer = 0; callback(...args); }, delay); }; } export { debounce };