index.js 591 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var core = require('@vueuse/core');
  5. const usePreventGlobal = (indicator, evt, cb) => {
  6. const prevent = (e) => {
  7. if (cb(e))
  8. e.stopImmediatePropagation();
  9. };
  10. let stop = void 0;
  11. vue.watch(() => indicator.value, (val) => {
  12. if (val) {
  13. stop = core.useEventListener(document, evt, prevent, true);
  14. } else {
  15. stop == null ? void 0 : stop();
  16. }
  17. }, { immediate: true });
  18. };
  19. exports.usePreventGlobal = usePreventGlobal;
  20. //# sourceMappingURL=index.js.map