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

Function $watchCollectionAction

lib/test/angular/1.8.0/angular.js:19065–19092  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19063 }
19064
19065 function $watchCollectionAction() {
19066 if (initRun) {
19067 initRun = false;
19068 listener(newValue, newValue, self);
19069 } else {
19070 listener(newValue, veryOldValue, self);
19071 }
19072
19073 // make a copy for the next time a collection is changed
19074 if (trackVeryOldValue) {
19075 if (!isObject(newValue)) {
19076 //primitive
19077 veryOldValue = newValue;
19078 } else if (isArrayLike(newValue)) {
19079 veryOldValue = new Array(newValue.length);
19080 for (var i = 0; i < newValue.length; i++) {
19081 veryOldValue[i] = newValue[i];
19082 }
19083 } else { // if object
19084 veryOldValue = {};
19085 for (var key in newValue) {
19086 if (hasOwnProperty.call(newValue, key)) {
19087 veryOldValue[key] = newValue[key];
19088 }
19089 }
19090 }
19091 }
19092 }
19093
19094 return this.$watch(changeDetector, $watchCollectionAction);
19095 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected