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

Function $watchCollectionAction

test/angular/1.2/angular.js:12569–12596  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12567 }
12568
12569 function $watchCollectionAction() {
12570 if (initRun) {
12571 initRun = false;
12572 listener(newValue, newValue, self);
12573 } else {
12574 listener(newValue, veryOldValue, self);
12575 }
12576
12577 // make a copy for the next time a collection is changed
12578 if (trackVeryOldValue) {
12579 if (!isObject(newValue)) {
12580 //primitive
12581 veryOldValue = newValue;
12582 } else if (isArrayLike(newValue)) {
12583 veryOldValue = new Array(newValue.length);
12584 for (var i = 0; i < newValue.length; i++) {
12585 veryOldValue[i] = newValue[i];
12586 }
12587 } else { // if object
12588 veryOldValue = {};
12589 for (var key in newValue) {
12590 if (hasOwnProperty.call(newValue, key)) {
12591 veryOldValue[key] = newValue[key];
12592 }
12593 }
12594 }
12595 }
12596 }
12597
12598 return this.$watch($watchCollectionWatch, $watchCollectionAction);
12599 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected