| 263 | */ |
| 264 | @Service() |
| 265 | export class ApplicationRef { |
| 266 | /** @internal */ |
| 267 | _runningTick: boolean = false; |
| 268 | private _destroyed = false; |
| 269 | private _destroyListeners: Array<() => void> = []; |
| 270 | /** @internal */ |
| 271 | _views: InternalViewRef<unknown>[] = []; |
| 272 | private readonly internalErrorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER); |
| 273 | private readonly afterRenderManager = inject(AfterRenderManager); |
| 274 | private readonly zonelessEnabled = inject(ZONELESS_ENABLED); |
| 275 | private readonly rootEffectScheduler = inject(EffectScheduler); |
| 276 | |
| 277 | /** |
| 278 | * Current dirty state of the application across a number of dimensions (views, afterRender hooks, |
| 279 | * etc). |
| 280 | * |
| 281 | * A flag set here means that `tick()` will attempt to resolve the dirtiness when executed. |
| 282 | * |
| 283 | * @internal |
| 284 | */ |
| 285 | dirtyFlags = ApplicationRefDirtyFlags.None; |
| 286 | |
| 287 | /** |
| 288 | * Most recent snapshot from the `TracingService`, if any. |
| 289 | * |
| 290 | * This snapshot attempts to capture the context when `tick()` was first |
| 291 | * scheduled. It then runs wrapped in this context. |
| 292 | * |
| 293 | * @internal |
| 294 | */ |
| 295 | tracingSnapshot: TracingSnapshot | null = null; |
| 296 | |
| 297 | // Needed for ComponentFixture temporarily during migration of autoDetect behavior |
| 298 | // Eventually the hostView of the fixture should just attach to ApplicationRef. |
| 299 | private allTestViews: Set<InternalViewRef<unknown>> = new Set(); |
| 300 | private autoDetectTestViews: Set<InternalViewRef<unknown>> = new Set(); |
| 301 | /** @internal */ |
| 302 | includeAllTestViews = false; |
| 303 | /** @internal */ |
| 304 | afterTick = new Subject<void>(); |
| 305 | /** @internal */ |
| 306 | get allViews(): Array<InternalViewRef<unknown>> { |
| 307 | return [ |
| 308 | ...(this.includeAllTestViews ? this.allTestViews : this.autoDetectTestViews).keys(), |
| 309 | ...this._views, |
| 310 | ]; |
| 311 | } |
| 312 | |
| 313 | /** |
| 314 | * Indicates whether this instance was destroyed. |
| 315 | */ |
| 316 | get destroyed() { |
| 317 | return this._destroyed; |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * Get a list of component types registered to this application. |
| 322 | * This list is populated even before the component is created. |
nothing calls this directly
no test coverage detected