MCPcopy Create free account
hub / github.com/angular/angular / dynamicImportOf

Function dynamicImportOf

packages/core/test/acceptance/defer_spec.ts:76–80  ·  view source on GitHub ↗

* Emulates a dynamic import promise. * * Note: `setTimeout` is used to make `fixture.whenStable()` function * wait for promise resolution, since `whenStable()` relies on the state * of a macrotask queue.

(type: T, timeout = 0)

Source from the content-addressed store, hash-verified

74 * of a macrotask queue.
75 */
76function dynamicImportOf<T>(type: T, timeout = 0): Promise<T> {
77 return new Promise<T>((resolve) => {
78 setTimeout(() => resolve(type), timeout);
79 });
80}
81
82/**
83 * Emulates a failed dynamic import promise.

Callers 2

allPendingDynamicImportsFunction · 0.70
interceptFunction · 0.70

Calls 2

setTimeoutFunction · 0.85
resolveFunction · 0.50

Tested by

no test coverage detected