(fn: T)
| 1073 | * @experimental |
| 1074 | */ |
| 1075 | export 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 | |
| 1091 | function getOrCreateRootProxy() { |
| 1092 | const ProxyZoneSpec = getProxyZoneSpec(); |
no outgoing calls
no test coverage detected
searching dependent graphs…