Ohm-Management - Projektarbeit B-ME
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.

registrable.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.inject = inject;
  6. exports.provide = provide;
  7. var _vue = require('vue');
  8. var _vue2 = _interopRequireDefault(_vue);
  9. var _console = require('../util/console');
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  12. function generateWarning(child, parent) {
  13. return function () {
  14. return (0, _console.consoleWarn)('The ' + child + ' component must be used inside a ' + parent);
  15. };
  16. }
  17. function inject(namespace, child, parent) {
  18. var defaultImpl = child && parent ? {
  19. register: generateWarning(child, parent),
  20. unregister: generateWarning(child, parent)
  21. } : null;
  22. return _vue2.default.extend({
  23. name: 'registrable-inject',
  24. inject: _defineProperty({}, namespace, {
  25. default: defaultImpl
  26. })
  27. });
  28. }
  29. function provide(namespace) {
  30. return _vue2.default.extend({
  31. name: 'registrable-provide',
  32. methods: {
  33. register: null,
  34. unregister: null
  35. },
  36. provide: function provide() {
  37. return _defineProperty({}, namespace, {
  38. register: this.register,
  39. unregister: this.unregister
  40. });
  41. }
  42. });
  43. }
  44. //# sourceMappingURL=registrable.js.map