MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / $watchCollectionAction

Function $watchCollectionAction

code/songhop/www/lib/angular/angular.js:14057–14084  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14055 }
14056
14057 function $watchCollectionAction() {
14058 if (initRun) {
14059 initRun = false;
14060 listener(newValue, newValue, self);
14061 } else {
14062 listener(newValue, veryOldValue, self);
14063 }
14064
14065 // make a copy for the next time a collection is changed
14066 if (trackVeryOldValue) {
14067 if (!isObject(newValue)) {
14068 //primitive
14069 veryOldValue = newValue;
14070 } else if (isArrayLike(newValue)) {
14071 veryOldValue = new Array(newValue.length);
14072 for (var i = 0; i < newValue.length; i++) {
14073 veryOldValue[i] = newValue[i];
14074 }
14075 } else { // if object
14076 veryOldValue = {};
14077 for (var key in newValue) {
14078 if (hasOwnProperty.call(newValue, key)) {
14079 veryOldValue[key] = newValue[key];
14080 }
14081 }
14082 }
14083 }
14084 }
14085
14086 return this.$watch(changeDetector, $watchCollectionAction);
14087 },

Callers

nothing calls this directly

Calls 3

listenerFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70

Tested by

no test coverage detected