You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
504 B

1 month ago
  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