@oruga-ui/oruga-next
Version:
UI components for Vue.js and CSS framework agnostic
18 lines (17 loc) • 520 B
JavaScript
;
/*! Oruga v0.11.4 | MIT License | github.com/oruga-ui/oruga */
function useDebounce(func, wait, immediate) {
let timeout;
return (...args) => {
const later = () => {
timeout = void 0;
if (!immediate) func.apply(this, args);
};
const callNow = immediate && !timeout;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(this, args);
};
}
exports.useDebounce = useDebounce;
//# sourceMappingURL=useDebounce-CeqYk8AA.cjs.map