MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / $watchCollectionAction

Function $watchCollectionAction

test/fixtures/foo.js:12380–12407  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12378 }
12379
12380 function $watchCollectionAction() {
12381 if (initRun) {
12382 initRun = false;
12383 listener(newValue, newValue, self);
12384 } else {
12385 listener(newValue, veryOldValue, self);
12386 }
12387
12388 // make a copy for the next time a collection is changed
12389 if (trackVeryOldValue) {
12390 if (!isObject(newValue)) {
12391 //primitive
12392 veryOldValue = newValue;
12393 } else if (isArrayLike(newValue)) {
12394 veryOldValue = new Array(newValue.length);
12395 for (var i = 0; i < newValue.length; i++) {
12396 veryOldValue[i] = newValue[i];
12397 }
12398 } else { // if object
12399 veryOldValue = {};
12400 for (var key in newValue) {
12401 if (hasOwnProperty.call(newValue, key)) {
12402 veryOldValue[key] = newValue[key];
12403 }
12404 }
12405 }
12406 }
12407 }
12408
12409 return this.$watch($watchCollectionWatch, $watchCollectionAction);
12410 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.85
isObjectFunction · 0.85
isArrayLikeFunction · 0.85

Tested by

no test coverage detected