import { shallowRef, onMounted } from 'vue';

function useDelayReset(timeout = 10) {
  const bool = shallowRef(false);
  let delay;
  const cancelLatest = () => {
    clearTimeout(delay);
  };
  onMounted(() => {
    cancelLatest();
  });
  const delaySetBool = (value, callback) => {
    cancelLatest();
    delay = setTimeout(() => {
      bool.value = value;
      if (callback)
        callback();
    }, timeout);
  };
  return [bool, delaySetBool, cancelLatest];
}

export { useDelayReset as default };
//# sourceMappingURL=useDelayReset.mjs.map
