此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
Clients.get()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2018年4月.
Clients 接口的 get() 方法 获取给定 id 匹配的 Service Worker client,并在 Promise 中返回它。
语法
js
self.clients.get(id).then(function (client) {
// do something with your returned client
});
参数
返回
示例
js
self.clients.get(options).then(function (client) {
self.clients.openWindow(client.url);
});
规范
| Specification |
|---|
| Service Workers> # clients-get> |
浏览器兼容性
Loading...