@stackoverfloweth/vue-compositions
Version:
A collection of reusable vue compositions.
12 lines • 423 B
JavaScript
import { getCurrentInstance, inject } from 'vue';
import { getSymbolForInjectionKey } from '../utilities/symbols';
export function injectFromSelfOrAncestor(key) {
const vm = getCurrentInstance();
const symbol = getSymbolForInjectionKey(key);
const value = vm?.provides[symbol];
if (value !== undefined) {
return value;
}
return inject(key, undefined);
}
//# sourceMappingURL=injection.js.map