项目原始demo,不改动
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Pode ver ficheiros e cloná-lo, mas não pode fazer envios ou lançar questões ou pedidos de integração.
 
 
 
 

71 linhas
2.7 KiB

  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = exports.Mutate = void 0;
  6. function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
  7. function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  8. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9. function inserted(el, binding) {
  10. var modifiers = binding.modifiers ||
  11. /* istanbul ignore next */
  12. {};
  13. var value = binding.value;
  14. var isObject = _typeof(value) === 'object';
  15. var callback = isObject ? value.handler : value;
  16. var once = modifiers.once,
  17. modifierKeys = _objectWithoutProperties(modifiers, ["once"]);
  18. var hasModifiers = Object.keys(modifierKeys).length > 0;
  19. var hasOptions = isObject && value.options; // Options take top priority
  20. var options = hasOptions ? value.options : hasModifiers // If we have modifiers, use only those provided
  21. ? {
  22. attributes: modifierKeys.attr,
  23. childList: modifierKeys.child,
  24. subtree: modifierKeys.sub,
  25. characterData: modifierKeys.char // Defaults to everything on
  26. } : {
  27. attributes: true,
  28. childList: true,
  29. subtree: true,
  30. characterData: true
  31. };
  32. var observer = new MutationObserver(function (mutationsList, observer) {
  33. /* istanbul ignore if */
  34. if (!el._mutate) return; // Just in case, should never fire
  35. callback(mutationsList, observer); // If has the once modifier, unbind
  36. once && unbind(el);
  37. });
  38. observer.observe(el, options);
  39. el._mutate = {
  40. observer: observer
  41. };
  42. }
  43. function unbind(el) {
  44. /* istanbul ignore if */
  45. if (!el._mutate) return;
  46. el._mutate.observer.disconnect();
  47. delete el._mutate;
  48. }
  49. var Mutate = {
  50. inserted: inserted,
  51. unbind: unbind
  52. };
  53. exports.Mutate = Mutate;
  54. var _default = Mutate;
  55. exports.default = _default;
  56. //# sourceMappingURL=index.js.map