1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { Observable } from 'rxjs';
|
---|
9 | /** Current state of the intercepted zone. */
|
---|
10 | export interface TaskState {
|
---|
11 | /** Whether the zone is stable (i.e. no microtasks and macrotasks). */
|
---|
12 | stable: boolean;
|
---|
13 | }
|
---|
14 | /**
|
---|
15 | * Interceptor that can be set up in a `ProxyZone` instance. The interceptor
|
---|
16 | * will keep track of the task state and emit whenever the state changes.
|
---|
17 | *
|
---|
18 | * This serves as a workaround for https://github.com/angular/angular/issues/32896.
|
---|
19 | */
|
---|
20 | export declare class TaskStateZoneInterceptor {
|
---|
21 | private _lastState;
|
---|
22 | /** Subject that can be used to emit a new state change. */
|
---|
23 | private readonly _stateSubject;
|
---|
24 | /** Public observable that emits whenever the task state changes. */
|
---|
25 | readonly state: Observable<TaskState>;
|
---|
26 | constructor(_lastState: HasTaskState | null);
|
---|
27 | /** This will be called whenever the task state changes in the intercepted zone. */
|
---|
28 | onHasTask(delegate: ZoneDelegate, current: Zone, target: Zone, hasTaskState: HasTaskState): void;
|
---|
29 | /** Gets the task state from the internal ZoneJS task state. */
|
---|
30 | private _getTaskStateFromInternalZoneState;
|
---|
31 | /**
|
---|
32 | * Sets up the custom task state Zone interceptor in the `ProxyZone`. Throws if
|
---|
33 | * no `ProxyZone` could be found.
|
---|
34 | * @returns an observable that emits whenever the task state changes.
|
---|
35 | */
|
---|
36 | static setup(): Observable<TaskState>;
|
---|
37 | }
|
---|