UNPKG

vue-hooks-plus

Version:
23 lines (22 loc) 442 B
import { ref, watch } from "vue"; import useThrottleFn from "../useThrottleFn"; function useThrottle(value, options) { const throttled = ref(); throttled.value = value.value; const { run } = useThrottleFn(() => { throttled.value = value.value; }, options); watch( value, () => { run == null ? void 0 : run(); }, { immediate: true } ); return throttled; } export { useThrottle as default };