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

Function initInjections

static/vuejs/vue.runtime.common.js:3665–3704  ·  view source on GitHub ↗
(vm)

Source from the content-addressed store, hash-verified

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

Callers 1

initMixinFunction · 0.70

Calls 1

loopFunction · 0.70

Tested by

no test coverage detected