MCPcopy Create free account
hub / github.com/angular-ui/ui-router / $watchCollectionAction

Function $watchCollectionAction

test/angular/1.5/angular.js:17694–17721  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17692 }
17693
17694 function $watchCollectionAction() {
17695 if (initRun) {
17696 initRun = false;
17697 listener(newValue, newValue, self);
17698 } else {
17699 listener(newValue, veryOldValue, self);
17700 }
17701
17702 // make a copy for the next time a collection is changed
17703 if (trackVeryOldValue) {
17704 if (!isObject(newValue)) {
17705 //primitive
17706 veryOldValue = newValue;
17707 } else if (isArrayLike(newValue)) {
17708 veryOldValue = new Array(newValue.length);
17709 for (var i = 0; i < newValue.length; i++) {
17710 veryOldValue[i] = newValue[i];
17711 }
17712 } else { // if object
17713 veryOldValue = {};
17714 for (var key in newValue) {
17715 if (hasOwnProperty.call(newValue, key)) {
17716 veryOldValue[key] = newValue[key];
17717 }
17718 }
17719 }
17720 }
17721 }
17722
17723 return this.$watch(changeDetector, $watchCollectionAction);
17724 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected