Skip to content

Zone.js 原理

Published: at 08:00 AM

Zone

What is the releation between zone and view engine and ivy?

Zone.js, View Engine, and Ivy are all related to Angular, a popular web application framework.

Zone.js

View Engine

Ivy

Relation Among Them

Overall, Zone.js facilitates change detection, while View Engine and Ivy are responsible for rendering Angular applications. Ivy represents a significant evolution in Angular’s rendering strategy.

Zoneless in angular 18

blog about zoneless in angular 18: https://blog.logrocket.com/zoneless-change-detection-angular-18/

official doc: https://angular.dev/guide/experimental/zoneless

Zone.js monkey patching

In Angular, Zone.js uses a technique called “monkey patching” to manipulate the browser’s native asynchronous APIs, such as timers, XHR requests, and DOM events. Instead of directly replacing these functions, Zone.js creates wrappers around them. These wrappers intercept the original behavior and inject additional logic. This allows Zone.js to track the start and finish of these asynchronous operations and inform Angular’s change detection mechanism when the asynchronous task is completed.

issues with zone.js

Zoneless change detection