MCPcopy
hub / github.com/fanmingming/live / observe

Function observe

m3u8/vue.js:988–1008  ·  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.

(value, asRootData)

Source from the content-addressed store, hash-verified

986 * or the existing observer if the value already has one.
987 */
988 function observe (value, asRootData) {
989 if (!isObject(value) || value instanceof VNode) {
990 return
991 }
992 var ob;
993 if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
994 ob = value.__ob__;
995 } else if (
996 shouldObserve &&
997 !isServerRendering() &&
998 (Array.isArray(value) || isPlainObject(value)) &&
999 Object.isExtensible(value) &&
1000 !value._isVue
1001 ) {
1002 ob = new Observer(value);
1003 }
1004 if (asRootData && ob) {
1005 ob.vmCount++;
1006 }
1007 return ob
1008 }
1009
1010 /**
1011 * Define a reactive property on an Object.

Callers 6

vue.jsFile · 0.85
defineReactive$$1Function · 0.85
validatePropFunction · 0.85
initStateFunction · 0.85
initDataFunction · 0.85
initGlobalAPIFunction · 0.85

Calls 4

isObjectFunction · 0.85
hasOwnFunction · 0.85
isServerRenderingFunction · 0.85
isPlainObjectFunction · 0.85

Tested by

no test coverage detected