MCPcopy Create free account
hub / github.com/cloudflare/meet / resolveMainClient

Function resolveMainClient

public/mockServiceWorker.js:155–176  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

153// that registered the worker. It's with the latter the worker should
154// communicate with during the response resolving phase.
155async function resolveMainClient(event) {
156 const client = await self.clients.get(event.clientId)
157
158 if (client?.frameType === 'top-level') {
159 return client
160 }
161
162 const allClients = await self.clients.matchAll({
163 type: 'window',
164 })
165
166 return allClients
167 .filter((client) => {
168 // Get only those clients that are currently visible.
169 return client.visibilityState === 'visible'
170 })
171 .find((client) => {
172 // Find the client ID that's recorded in the
173 // set of clients that have registered the worker.
174 return activeClientIds.has(client.id)
175 })
176}
177
178async function getResponse(event, client, requestId) {
179 const { request } = event

Callers 1

handleRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected