'use strict';

var vue = require('vue');

const useTimeoutPromise = () => {
  const timeoutids = vue.ref(/* @__PURE__ */ new Set());
  const start = (delay = 1e3) => {
    return new Promise((resolve) => {
      const newId = window.setTimeout(() => {
        timeoutids.value.delete(newId);
        resolve(newId);
      }, delay);
      timeoutids.value.add(newId);
    });
  };
  vue.onUnmounted(() => {
    timeoutids.value.forEach((id) => {
      window.clearTimeout(id);
    });
  });
  return {
    start
  };
};

exports.useTimeoutPromise = useTimeoutPromise;
//# sourceMappingURL=index.js.map
