(key, currentValue, previousValue)
| 10283 | }); |
| 10284 | |
| 10285 | function recordChanges(key, currentValue, previousValue) { |
| 10286 | if (isFunction(destination.$onChanges) && currentValue !== previousValue && |
| 10287 | // eslint-disable-next-line no-self-compare |
| 10288 | (currentValue === currentValue || previousValue === previousValue)) { |
| 10289 | // If we have not already scheduled the top level onChangesQueue handler then do so now |
| 10290 | if (!onChangesQueue) { |
| 10291 | scope.$$postDigest(flushOnChangesQueue); |
| 10292 | onChangesQueue = []; |
| 10293 | } |
| 10294 | // If we have not already queued a trigger of onChanges for this controller then do so now |
| 10295 | if (!changes) { |
| 10296 | changes = {}; |
| 10297 | onChangesQueue.push(triggerOnChangesHook); |
| 10298 | } |
| 10299 | // If the has been a change on this property already then we need to reuse the previous value |
| 10300 | if (changes[key]) { |
| 10301 | previousValue = changes[key].previousValue; |
| 10302 | } |
| 10303 | // Store this change |
| 10304 | changes[key] = new SimpleChange(previousValue, currentValue); |
| 10305 | } |
| 10306 | } |
| 10307 | |
| 10308 | function triggerOnChangesHook() { |
| 10309 | destination.$onChanges(changes); |
no test coverage detected