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

Function withProxyZone

packages/zone.js/lib/zone-spec/fake-async-test.ts:1075–1089  ·  view source on GitHub ↗
(fn: T)

Source from the content-addressed store, hash-verified

1073 * @experimental
1074 */
1075export function withProxyZone<T extends Function>(fn: T): T {
1076 const autoProxyFn: any = function (this: unknown, ...args: any[]) {
1077 const proxyZoneSpec = getProxyZoneSpec();
1078 if (proxyZoneSpec === undefined) {
1079 throw new Error(
1080 'ProxyZoneSpec is needed for the withProxyZone() test helper but could not be found. ' +
1081 'Make sure that your environment includes zone-testing.js',
1082 );
1083 }
1084
1085 const proxyZone = proxyZoneSpec.get() !== undefined ? Zone.current : getOrCreateRootProxy();
1086 return proxyZone.run(fn, this, args);
1087 };
1088 return autoProxyFn as T;
1089}
1090
1091function getOrCreateRootProxy() {
1092 const ProxyZoneSpec = getProxyZoneSpec();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…