* Observer class that are attached to each observed * object. Once attached, the observer converts target * object's property keys into getter/setters that * collect dependencies and dispatches updates. * * @param {Array|Object} value * @constructor
(value)
| 2106 | */ |
| 2107 | |
| 2108 | function Observer(value) { |
| 2109 | this.value = value; |
| 2110 | this.dep = new Dep(); |
| 2111 | def(value, '__ob__', this); |
| 2112 | if (isArray(value)) { |
| 2113 | var augment = hasProto ? protoAugment : copyAugment; |
| 2114 | augment(value, arrayMethods, arrayKeys); |
| 2115 | this.observeArray(value); |
| 2116 | } else { |
| 2117 | this.walk(value); |
| 2118 | } |
| 2119 | } |
| 2120 | |
| 2121 | // Instance methods |
| 2122 |