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

Function initComputed

static/vuejs/vue.runtime.esm.js:2758–2783  ·  view source on GitHub ↗
(vm, computed)

Source from the content-addressed store, hash-verified

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

Callers 1

initStateFunction · 0.70

Calls 2

defineComputedFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected