index.mjs 504 B

1234567891011121314151617181920
  1. import { watch } from 'vue';
  2. import { useEventListener } from '@vueuse/core';
  3. const usePreventGlobal = (indicator, evt, cb) => {
  4. const prevent = (e) => {
  5. if (cb(e))
  6. e.stopImmediatePropagation();
  7. };
  8. let stop = void 0;
  9. watch(() => indicator.value, (val) => {
  10. if (val) {
  11. stop = useEventListener(document, evt, prevent, true);
  12. } else {
  13. stop == null ? void 0 : stop();
  14. }
  15. }, { immediate: true });
  16. };
  17. export { usePreventGlobal };
  18. //# sourceMappingURL=index.mjs.map