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

Function $watchCollectionAction

test/angular/1.7/angular.js:19000–19027  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18998 }
18999
19000 function $watchCollectionAction() {
19001 if (initRun) {
19002 initRun = false;
19003 listener(newValue, newValue, self);
19004 } else {
19005 listener(newValue, veryOldValue, self);
19006 }
19007
19008 // make a copy for the next time a collection is changed
19009 if (trackVeryOldValue) {
19010 if (!isObject(newValue)) {
19011 //primitive
19012 veryOldValue = newValue;
19013 } else if (isArrayLike(newValue)) {
19014 veryOldValue = new Array(newValue.length);
19015 for (var i = 0; i < newValue.length; i++) {
19016 veryOldValue[i] = newValue[i];
19017 }
19018 } else { // if object
19019 veryOldValue = {};
19020 for (var key in newValue) {
19021 if (hasOwnProperty.call(newValue, key)) {
19022 veryOldValue[key] = newValue[key];
19023 }
19024 }
19025 }
19026 }
19027 }
19028
19029 return this.$watch(changeDetector, $watchCollectionAction);
19030 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected