UNPKG

2.96 kBTypeScriptView Raw
1import DebugInfo from './-internal/debug-info';
2/**
3 Clears listeners that were previously setup for `ajaxSend` and `ajaxComplete`.
4
5 @private
6*/
7export declare function _teardownAJAXHooks(): void;
8/**
9 Sets up listeners for `ajaxSend` and `ajaxComplete`.
10
11 @private
12*/
13export declare function _setupAJAXHooks(): void;
14export interface SettledState {
15 hasRunLoop: boolean;
16 hasPendingTimers: boolean;
17 hasPendingWaiters: boolean;
18 hasPendingRequests: boolean;
19 hasPendingTransitions: boolean | null;
20 isRenderPending: boolean;
21 pendingRequestCount: number;
22 debugInfo: DebugInfo;
23}
24/**
25 Check various settledness metrics, and return an object with the following properties:
26
27 - `hasRunLoop` - Checks if a run-loop has been started. If it has, this will
28 be `true` otherwise it will be `false`.
29 - `hasPendingTimers` - Checks if there are scheduled timers in the run-loop.
30 These pending timers are primarily registered by `Ember.run.schedule`. If
31 there are pending timers, this will be `true`, otherwise `false`.
32 - `hasPendingWaiters` - Checks if any registered test waiters are still
33 pending (e.g. the waiter returns `true`). If there are pending waiters,
34 this will be `true`, otherwise `false`.
35 - `hasPendingRequests` - Checks if there are pending AJAX requests (based on
36 `ajaxSend` / `ajaxComplete` events triggered by `jQuery.ajax`). If there
37 are pending requests, this will be `true`, otherwise `false`.
38 - `hasPendingTransitions` - Checks if there are pending route transitions. If the
39 router has not been instantiated / setup for the test yet this will return `null`,
40 if there are pending transitions, this will be `true`, otherwise `false`.
41 - `pendingRequestCount` - The count of pending AJAX requests.
42 - `debugInfo` - Debug information that's combined with info return from backburner's
43 getDebugInfo method.
44 - `isRenderPending` - Checks if there are any pending render operations. This will be true as long
45 as there are tracked values in the template that have not been rerendered yet.
46
47 @public
48 @returns {Object} object with properties for each of the metrics used to determine settledness
49*/
50export declare function getSettledState(): SettledState;
51/**
52 Checks various settledness metrics (via `getSettledState()`) to determine if things are settled or not.
53
54 Settled generally means that there are no pending timers, no pending waiters,
55 no pending AJAX requests, and no current run loop. However, new settledness
56 metrics may be added and used as they become available.
57
58 @public
59 @returns {boolean} `true` if settled, `false` otherwise
60*/
61export declare function isSettled(): boolean;
62/**
63 Returns a promise that resolves when in a settled state (see `isSettled` for
64 a definition of "settled state").
65
66 @public
67 @returns {Promise<void>} resolves when settled
68*/
69export default function settled(): Promise<void>;
70//# sourceMappingURL=settled.d.ts.map
\No newline at end of file