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

Method handleFetch

packages/service-worker/worker/src/debug.ts:35–76  ·  view source on GitHub ↗
(req: Request)

Source from the content-addressed store, hash-verified

33 ) {}
34
35 async handleFetch(req: Request): Promise<Response> {
36 const [state, versions, idle] = await Promise.all([
37 this.driver.debugState(),
38 this.driver.debugVersions(),
39 this.driver.debugIdleState(),
40 ]);
41
42 const msgState = `NGSW Debug Info:
43
44Driver version: ${SW_VERSION}
45Driver state: ${state.state} (${state.why})
46Latest manifest hash: ${state.latestHash || 'none'}
47Last update check: ${this.since(state.lastUpdateCheck)}`;
48
49 const msgVersions = versions
50 .map(
51 (version) => `=== Version ${version.hash} ===
52
53Clients: ${version.clients.join(', ')}`,
54 )
55 .join('\n\n');
56
57 const msgIdle = `=== Idle Task Queue ===
58Last update tick: ${this.since(idle.lastTrigger)}
59Last update run: ${this.since(idle.lastRun)}
60Task queue:
61${idle.queue.map((v) => ' * ' + v).join('\n')}
62
63Debug log:
64${this.formatDebugLog(this.debugLogB)}
65${this.formatDebugLog(this.debugLogA)}
66`;
67
68 return this.adapter.newResponse(
69 `${msgState}
70
71${msgVersions}
72
73${msgIdle}`,
74 {headers: this.adapter.newHeaders({'Content-Type': 'text/plain'})},
75 );
76 }
77
78 since(time: number | null): string {
79 if (time === null) {

Callers

nothing calls this directly

Calls 10

sinceMethod · 0.95
formatDebugLogMethod · 0.95
mapMethod · 0.80
debugStateMethod · 0.65
debugVersionsMethod · 0.65
debugIdleStateMethod · 0.65
joinMethod · 0.65
allMethod · 0.45
newResponseMethod · 0.45
newHeadersMethod · 0.45

Tested by

no test coverage detected