MCPcopy Index your code
hub / github.com/ygs-code/vue / Observer

Function Observer

vue.js:1345–1362  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1343 * 实例化 dep对象,获取dep对象 为 value添加__ob__ 属性
1344 */
1345 var Observer = function Observer(value) {
1346
1347
1348 this.value = value;
1349 this.dep = new Dep();
1350 this.vmCount = 0;
1351 //设置监听 value 必须是对象
1352 def(value, '__ob__', this);
1353 if (Array.isArray(value)) { //判断是不是数组
1354 var augment = hasProto //__proto__ 存在么 高级浏览器都会有这个
1355 ? protoAugment
1356 : copyAugment;
1357 augment(value, arrayMethods, arrayKeys);
1358 this.observeArray(value);
1359 } else {
1360 this.walk(value);
1361 }
1362 };
1363
1364 /**
1365 * Walk through each property and convert them into

Callers

nothing calls this directly

Calls 1

defFunction · 0.85

Tested by

no test coverage detected