event.waitUntil(
clients
.matchAll({
type: "window",
})
.then((clientList) => {
for (const client of clientList) {
if (client.url === "/" && "focus" in client) {
if (client.visibilityState === "hidden") return client.focus();
}
}
if (clients.openWindow) {
return clients.openWindow("/");
}
}),
);WindowClient: visibilityState property / notebook
WindowClient: visibilityState property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.