MCPcopy Index your code
hub / github.com/angular-ui/ui-router / $watchCollectionAction

Function $watchCollectionAction

test/angular/1.6/angular.js:18400–18427  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18398 }
18399
18400 function $watchCollectionAction() {
18401 if (initRun) {
18402 initRun = false;
18403 listener(newValue, newValue, self);
18404 } else {
18405 listener(newValue, veryOldValue, self);
18406 }
18407
18408 // make a copy for the next time a collection is changed
18409 if (trackVeryOldValue) {
18410 if (!isObject(newValue)) {
18411 //primitive
18412 veryOldValue = newValue;
18413 } else if (isArrayLike(newValue)) {
18414 veryOldValue = new Array(newValue.length);
18415 for (var i = 0; i < newValue.length; i++) {
18416 veryOldValue[i] = newValue[i];
18417 }
18418 } else { // if object
18419 veryOldValue = {};
18420 for (var key in newValue) {
18421 if (hasOwnProperty.call(newValue, key)) {
18422 veryOldValue[key] = newValue[key];
18423 }
18424 }
18425 }
18426 }
18427 }
18428
18429 return this.$watch(changeDetector, $watchCollectionAction);
18430 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected