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

Function $watchCollectionAction

test/angular/1.3/angular.js:14274–14301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14272 }
14273
14274 function $watchCollectionAction() {
14275 if (initRun) {
14276 initRun = false;
14277 listener(newValue, newValue, self);
14278 } else {
14279 listener(newValue, veryOldValue, self);
14280 }
14281
14282 // make a copy for the next time a collection is changed
14283 if (trackVeryOldValue) {
14284 if (!isObject(newValue)) {
14285 //primitive
14286 veryOldValue = newValue;
14287 } else if (isArrayLike(newValue)) {
14288 veryOldValue = new Array(newValue.length);
14289 for (var i = 0; i < newValue.length; i++) {
14290 veryOldValue[i] = newValue[i];
14291 }
14292 } else { // if object
14293 veryOldValue = {};
14294 for (var key in newValue) {
14295 if (hasOwnProperty.call(newValue, key)) {
14296 veryOldValue[key] = newValue[key];
14297 }
14298 }
14299 }
14300 }
14301 }
14302
14303 return this.$watch(changeDetector, $watchCollectionAction);
14304 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected