This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/mixins/registrable/index.js
2019-08-11 20:48:02 +02:00

41 lines
No EOL
937 B
JavaScript

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