MCPcopy Create free account
hub / github.com/TruthHun/BookStack / initInjections

Function initInjections

static/vuejs/vue.common.js:3669–3708  ·  view source on GitHub ↗
(vm)

Source from the content-addressed store, hash-verified

3667}
3668
3669function initInjections (vm) {
3670 var inject = vm.$options.inject;
3671 if (inject) {
3672 // inject is :any because flow is not smart enough to figure out cached
3673 // isArray here
3674 var isArray = Array.isArray(inject);
3675 var keys = isArray
3676 ? inject
3677 : hasSymbol
3678 ? Reflect.ownKeys(inject)
3679 : Object.keys(inject);
3680
3681 var loop = function ( i ) {
3682 var key = keys[i];
3683 var provideKey = isArray ? key : inject[key];
3684 var source = vm;
3685 while (source) {
3686 if (source._provided && provideKey in source._provided) {
3687 /* istanbul ignore else */
3688 if (process.env.NODE_ENV !== 'production') {
3689 defineReactive$$1(vm, key, source._provided[provideKey], function () {
3690 warn(
3691 "Avoid mutating an injected value directly since the changes will be " +
3692 "overwritten whenever the provided component re-renders. " +
3693 "injection being mutated: \"" + key + "\"",
3694 vm
3695 );
3696 });
3697 } else {
3698 defineReactive$$1(vm, key, source._provided[provideKey]);
3699 }
3700 break
3701 }
3702 source = source.$parent;
3703 }
3704 };
3705
3706 for (var i = 0; i < keys.length; i++) loop( i );
3707 }
3708}
3709
3710/* */
3711

Callers 1

initMixinFunction · 0.70

Calls 1

loopFunction · 0.70

Tested by

no test coverage detected