MCPcopy Create free account
hub / github.com/binux/qiandao / $watchCollectionAction

Function $watchCollectionAction

web/static/components/angularjs/angular.js:12339–12366  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12337 }
12338
12339 function $watchCollectionAction() {
12340 if (initRun) {
12341 initRun = false;
12342 listener(newValue, newValue, self);
12343 } else {
12344 listener(newValue, veryOldValue, self);
12345 }
12346
12347 // make a copy for the next time a collection is changed
12348 if (trackVeryOldValue) {
12349 if (!isObject(newValue)) {
12350 //primitive
12351 veryOldValue = newValue;
12352 } else if (isArrayLike(newValue)) {
12353 veryOldValue = new Array(newValue.length);
12354 for (var i = 0; i < newValue.length; i++) {
12355 veryOldValue[i] = newValue[i];
12356 }
12357 } else { // if object
12358 veryOldValue = {};
12359 for (var key in newValue) {
12360 if (hasOwnProperty.call(newValue, key)) {
12361 veryOldValue[key] = newValue[key];
12362 }
12363 }
12364 }
12365 }
12366 }
12367
12368 return this.$watch($watchCollectionWatch, $watchCollectionAction);
12369 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.85
isArrayLikeFunction · 0.85
isObjectFunction · 0.70

Tested by

no test coverage detected