Clients: get() method
Note: This feature is only available in Service Workers.
The get()
method of the
Clients
interface gets a service worker client matching a given
id
and returns it in a Promise
.
Syntax
js
get(id)
Parameters
id
-
A string representing the id of the client you want to get.
Return value
Examples
js
self.clients.get(id).then((client) => {
self.clients.openWindow(client.url);
});
Specifications
Specification |
---|
Service Workers # clients-get |
Browser compatibility
BCD tables only load in the browser