UNPKG

vue-hooks-plus

Version:
16 lines (15 loc) 564 B
"use strict"; const debounce = require("lodash-es/debounce"); const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e }; const debounce__default = /* @__PURE__ */ _interopDefaultLegacy(debounce); function useDebounceFn(fn, options) { var _a; const wait = (_a = options == null ? void 0 : options.wait) != null ? _a : 1e3; const debounced = debounce__default.default(fn, wait, options); return { run: debounced, cancel: debounced.cancel, flush: debounced.flush }; } module.exports = useDebounceFn;