Clients Class
The clients of a service worker (https://w3c.github.io/ServiceWorker/#clients-interface): the windows and the workers of its origin, in the browsing context group of the service worker.
public sealed class ClientsMethods
| Name | Description |
|---|---|
| Claim() | Makes the service worker the controller of the clients whose URL matches its registration (https://w3c.github.io/ServiceWorker/#clients-claim). |
| Get(string) | Returns the client whose id is id, or null (https://w3c.github.io/ServiceWorker/#clients-get). |
| MatchAll(ClientQueryOptions?) | Returns the clients of the service worker (https://w3c.github.io/ServiceWorker/#clients-matchall). |
| OpenWindow(string) | Opens a new top-level browsing context, navigated to url (https://w3c.github.io/ServiceWorker/#clients-openwindow): returns its window client, or null when its document does not have the origin of the service worker. |
Claim()
Clients.csMakes the service worker the controller of the clients whose URL matches its registration (https://w3c.github.io/ServiceWorker/#clients-claim).
public Task Claim()Returns
Exceptions
DomException- An
InvalidStateErrorwhen the service worker is not the active worker of its registration.
See also
Get(string)
Clients.csReturns the client whose id is id, or null (https://w3c.github.io/ServiceWorker/#clients-get).
MatchAll(ClientQueryOptions?)
Clients.csReturns the clients of the service worker (https://w3c.github.io/ServiceWorker/#clients-matchall).
public Task<IReadOnlyList<Client>> MatchAll(ClientQueryOptions? options = null)OpenWindow(string)
Clients.csOpens a new top-level browsing context, navigated to url (https://w3c.github.io/ServiceWorker/#clients-openwindow): returns its window client, or null when its document does not have the origin of the service worker.
public Task<WindowClient?> OpenWindow(string url)Parameters
urlstring
Returns
Remarks
A window of the origin must have the transient activation (e.g. the user clicked it).