refactor(fe): trim >30-line comment blocks (second pass, #2077)

This commit is contained in:
iris 2026-06-29 00:55:31 +02:00 committed by mara
commit 95b866a53d
5 changed files with 55 additions and 118 deletions

View file

@ -9,32 +9,19 @@
// { kind: 'unsubscribe', url: '/api/dashboard/stream' }
//
// worker → tab
// { kind: 'open', url: '...' } relayed from EventSource.onopen,
// plus a synthetic open fired to
// a brand-new subscriber when the
// upstream is already OPEN — so
// the page's onStreamOpen still
// runs and triggers a snapshot
// re-sync after a reconnect gap.
// { kind: 'open', url: '...' } relayed from EventSource.onopen; also
// fired synthetically to new subscribers
// when upstream is already OPEN (so
// onStreamOpen runs + re-syncs state).
// { kind: 'message', url: '...', data: '<raw SSE data string>' }
// { kind: 'error', url: '...' } relayed from EventSource.onerror.
// { kind: 'ping' } heartbeat — fired every
// PING_INTERVAL_MS to every
// connected port. The client's
// watchdog uses these as
// proof-of-life; silence past
// ~3× the interval triggers a
// re-subscribe on a fresh port
// (recovers from Firefox killing
// the SharedWorker out from
// under us, which it does under
// memory pressure with no native
// signal to the client).
// { kind: 'ping' } heartbeat every PING_INTERVAL_MS.
// Silence past ~3× triggers a re-subscribe
// (guards Firefox silently GCing the
// SharedWorker under memory pressure).
//
// Subscriptions are tracked per (port, url): a single port can
// subscribe to multiple URLs (only one is in use today).
// Unsubscribing the last port for a URL closes the EventSource so we
// don't keep idle streams open.
// Per (port, url) subscriptions; unsubscribing the last port for a URL closes
// the EventSource. One URL in use today; design allows multiple.
const streams = new Map();
// All currently-connected ports. Used by the heartbeat tick to fan