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

Function $watchCollectionAction

lib/test/angular/1.5.0/angular.js:16524–16551  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16522 }
16523
16524 function $watchCollectionAction() {
16525 if (initRun) {
16526 initRun = false;
16527 listener(newValue, newValue, self);
16528 } else {
16529 listener(newValue, veryOldValue, self);
16530 }
16531
16532 // make a copy for the next time a collection is changed
16533 if (trackVeryOldValue) {
16534 if (!isObject(newValue)) {
16535 //primitive
16536 veryOldValue = newValue;
16537 } else if (isArrayLike(newValue)) {
16538 veryOldValue = new Array(newValue.length);
16539 for (var i = 0; i < newValue.length; i++) {
16540 veryOldValue[i] = newValue[i];
16541 }
16542 } else { // if object
16543 veryOldValue = {};
16544 for (var key in newValue) {
16545 if (hasOwnProperty.call(newValue, key)) {
16546 veryOldValue[key] = newValue[key];
16547 }
16548 }
16549 }
16550 }
16551 }
16552
16553 return this.$watch(changeDetector, $watchCollectionAction);
16554 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected