vue-hooks-plus
Version:
Vue hooks library
15 lines (14 loc) • 356 B
JavaScript
import debounce from "lodash-es/debounce";
function useDebounceFn(fn, options) {
var _a;
const wait = (_a = options == null ? void 0 : options.wait) != null ? _a : 1e3;
const debounced = debounce(fn, wait, options);
return {
run: debounced,
cancel: debounced.cancel,
flush: debounced.flush
};
}
export {
useDebounceFn as default
};