--- title: Clients.get() slug: Web/API/Clients/get translation_of: Web/API/Clients/get ---
{{domxref("Clients")}} 接口的 get() 方法 获取给定 id 匹配的Service Worker client,并在 {{jsxref("Promise")}} 中返回它.
self.clients.get(id).then(function(client) {
// do something with your returned client
});
idPromise .self.clients.get(options).then(function(client) {
self.clients.openWindow(client.url);
});
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('Service Workers', '#clients-get-method', 'get()')}} | {{Spec2('Service Workers')}} | Initial definition |
{{Compat("api.Clients.get")}}