|
1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import Vue from 'vue';
- import { consoleWarn } from '../../util/console';
-
- function generateWarning(child, parent) {
- return () => consoleWarn(`The ${child} component must be used inside a ${parent}`);
- }
-
- export function inject(namespace, child, parent) {
- const defaultImpl = child && parent ? {
- register: generateWarning(child, parent),
- unregister: generateWarning(child, parent)
- } : null;
- return Vue.extend({
- name: 'registrable-inject',
- inject: {
- [namespace]: {
- default: defaultImpl
- }
- }
- });
- }
- export function provide(namespace, self = false) {
- return Vue.extend({
- name: 'registrable-provide',
- methods: self ? {} : {
- register: null,
- unregister: null
- },
-
- provide() {
- return {
- [namespace]: self ? this : {
- register: this.register,
- unregister: this.unregister
- }
- };
- }
-
- });
- }
- //# sourceMappingURL=index.js.map
|