MCPcopy Index your code
hub / github.com/angular/angular / whenStableWithTimeout

Function whenStableWithTimeout

packages/core/src/hydration/api.ts:145–163  ·  view source on GitHub ↗

* Returns a Promise that is resolved when an application becomes stable.

(appRef: ApplicationRef)

Source from the content-addressed store, hash-verified

143 * Returns a Promise that is resolved when an application becomes stable.
144 */
145function whenStableWithTimeout(appRef: ApplicationRef): Promise<void> {
146 const whenStablePromise = appRef.whenStable();
147 if (typeof ngDevMode !== 'undefined' && ngDevMode) {
148 const timeoutTime = APPLICATION_IS_STABLE_TIMEOUT;
149 const console = appRef.injector.get(Console);
150 const ngZone = appRef.injector.get(NgZone);
151
152 // The following call should not and does not prevent the app to become stable
153 // We cannot use RxJS timer here because the app would remain unstable.
154 // This also avoids an extra change detection cycle.
155 const timeoutId = ngZone.runOutsideAngular(() => {
156 return setTimeout(() => logWarningOnStableTimedout(timeoutTime, console), timeoutTime);
157 });
158
159 whenStablePromise.finally(() => clearTimeout(timeoutId));
160 }
161
162 return whenStablePromise;
163}
164
165/**
166 * Defines a name of an attribute that is added to the <body> tag

Callers 1

withDomHydrationFunction · 0.85

Calls 7

setTimeoutFunction · 0.85
clearTimeoutFunction · 0.85
finallyMethod · 0.80
whenStableMethod · 0.65
getMethod · 0.65
runOutsideAngularMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…