v148 · JavaScript · Web Workers

Worker Lifecycle Demo

A visual state machine for the Shared Worker lifecycle — from starting to keepalive to terminated. Simulate clients connecting and disconnecting, trigger keepalive events, and watch the timeline.

Checking SharedWorker support…

Worker state machine

starting
running
keepalive
terminating
terminated
Worker state
Connected clients
0
Worker uptime
0s

Simulation controls

Worker uptime vs. client count timeline

Worker not started

Lifetime extension triggers

Trigger Description Status in simulation
event.waitUntil(fetch(…)) A pending fetch() inside the worker keeps it alive inactive
extendedLifetime: true Constructor option to request extended lifetime support inactive
Notification pending Worker requested to show a notification that hasn't been dismissed inactive
Push message in-flight Worker processing a push message from the Push API inactive

Event log

--:--:--Simulation ready. Click "Spawn worker" to start.

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗