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