WorkerTiming

interface WorkerTiming

How much of itself the worker should describe on its own timeline.

A message rather than a query on the worker's URL, and the four reasons are worth keeping because the URL idea comes back:

  • browserWorker.ts uses the statically analyzed new Worker(new URL('…', import.meta.url)) form. Interpolating a runtime value defeats Vite's detection and the worker chunk stops being emitted.
  • apps/game/public/sw.js treats /assets/ as cache-first with a bare caches.match(request) and no ignoreSearch, so a query-suffixed worker misses the cache on an offline launch.
  • Inside a module worker the query is on self.location.search, not on new URL(import.meta.url).searchParams.
  • And the premise is false anyway. A URL is read once at spawn, while the level changes mid-session from ir.timing() and from the performance panel — which would leave the worker tracks silently empty for the rest of the session.

level is a bare string here on purpose. Which levels exist is the host's vocabulary, not the protocol's; this validates that a string arrived and the worker entry decides whether it names anything.

worker.ts:77

Members

kindreadonly

kind: 'timing'

levelreadonly

level: string