MCPcopy Index your code
hub / github.com/TruthHun/BookStack / initComputed

Function initComputed

static/vuejs/vue.js:2764–2789  ·  view source on GitHub ↗
(vm, computed)

Source from the content-addressed store, hash-verified

2762var computedWatcherOptions = { lazy: true };
2763
2764function initComputed (vm, computed) {
2765 var watchers = vm._computedWatchers = Object.create(null);
2766
2767 for (var key in computed) {
2768 var userDef = computed[key];
2769 var getter = typeof userDef === 'function' ? userDef : userDef.get;
2770 {
2771 if (getter === undefined) {
2772 warn(
2773 ("No getter function has been defined for computed property \"" + key + "\"."),
2774 vm
2775 );
2776 getter = noop;
2777 }
2778 }
2779 // create internal watcher for the computed property.
2780 watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
2781
2782 // component-defined computed properties are already defined on the
2783 // component prototype. We only need to define computed properties defined
2784 // at instantiation here.
2785 if (!(key in vm)) {
2786 defineComputed(vm, key, userDef);
2787 }
2788 }
2789}
2790
2791function defineComputed (target, key, userDef) {
2792 if (typeof userDef === 'function') {

Callers 1

initStateFunction · 0.70

Calls 2

defineComputedFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected