← Back to release summary

Add frozen or active lifecycleState to ServiceWorker Client

Category
Service Worker
Type
New or changed feature
Status
In developer trial (Behind a flag) (Chrome 77)
Intent stage
Evaluate readiness to ship

Summary

Exposes the client's PageLifecycle state on the ServiceWorker Client API.

Motivation

Service workers do not know the state of a client. If a client is frozen it will not immediately handle a postMessage() being sent to it. In some situations the service worker may not wish to spam the client with messages because that may cause the client to be discarded. In other situations the service worker may wish to focus the window client causing the client to become unfrozen.

Standards & signals

Docs: https://github.com/w3c/ServiceWorker/pull/1442

Explainers: https://github.com/dtapuska/iframe-freeze/blob/master/SW.md

View on chromestatus.com