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

Function dynamicImportOf

packages/core/test/acceptance/defer_spec.ts:75–79  ·  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

73 * of a macrotask queue.
74 */
75function dynamicImportOf<T>(type: T, timeout = 0): Promise<T> {
76 return new Promise<T>((resolve) => {
77 setTimeout(() => resolve(type), timeout);
78 });
79}
80
81/**
82 * 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