Service Workers API
Clients 接口的 get() 方法 获取给定 id 匹配的 Service Worker client,并在 Promise 中返回它。
语法
self.clients.get(id).then(function (client) {
// do something with your returned client
});
参数
id- : 一个 String ,表示你想要获取的 client id.
返回
一个 resolve 为 Client 对象的 Promise.
示例
self.clients.get(options).then(function (client) {
self.clients.openWindow(client.url);
});
规范
浏览器兼容性
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
