Angular (precisely: zone.js) monkey-patches functions like setTimeout()
, event listeners and similar, in order to fire the Change Detector when the respective callback got executed. However, Angular does not know which objects got updated and which remained unchanged. So, for every property used in the template, Angular has to check whether the property has been changed or not. This does not seem to be a very performant approach.
My question: Why does Angular not use Proxy objects for this? Proxy objects would allow Angular to exactly determine what has been changed, without having to compare the entire state tree. So is there any particular reason why the Angular devs chose not to use Proxy objects (as used in Vue)?
Btw: One advantage of a Proxy object could be that one could call functions in templates without causing additional/unnecessary CD cycles:
<div *ngFor="let item of myFunction()">...</div>