MCPcopy Index your code
hub / github.com/keepfool/vue-tutorials / observe

Function observe

06.Router/basic/js/vue.js:2228–2242  ·  view source on GitHub ↗

* Attempt to create an observer instance for a value, * returns the new observer if successfully observed, * or the existing observer if the value already has one. * * @param {*} value * @param {Vue} [vm] * @return {Observer|undefined} * @static

(value, vm)

Source from the content-addressed store, hash-verified

2226 */
2227
2228 function observe(value, vm) {
2229 if (!value || typeof value !== 'object') {
2230 return;
2231 }
2232 var ob;
2233 if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
2234 ob = value.__ob__;
2235 } else if (shouldConvert && (isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
2236 ob = new Observer(value);
2237 }
2238 if (ob && vm) {
2239 ob.addVm(vm);
2240 }
2241 return ob;
2242 }
2243
2244 /**
2245 * Define a reactive property on an Object.

Callers 3

vue.jsFile · 0.70
defineReactiveFunction · 0.70
stateMixinFunction · 0.70

Calls 3

isArrayFunction · 0.85
hasOwnFunction · 0.70
isPlainObjectFunction · 0.70

Tested by

no test coverage detected