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

Function initComputed

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

Source from the content-addressed store, hash-verified

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

Callers 1

initStateFunction · 0.70

Calls 2

defineComputedFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected