mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
41e2a68e30
All router events now have a `type` property with a string name identifying the specific type of the event. The `type` property can be used to perform TypeScript type narrowing using an `if` statement, `switch` statement, or similar. This removes the need to perform `instanceof` checks but still allows them if preferred. An `instanceof` check requires the use of the event class value which may not be available or preferred in certain situations. The Router's `enableTracing` option is also now guarded with the `ngDevMode` flag which combined with the use of a new `stringifyEvent` function allows the tree-shaking of the string generation code for each router event class. However, the original `toString` class methods are still present to prevent a potential breaking change. As a result, full benefits of the tree-shaking potential will not be realized until they are removed. PR Close #44189
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT