Clients.get()

Clients インターフェースの get() メソッドは、所与の id と一致するサービスワーカークライアントを取得し、Promise で返します。

構文

self.clients.get(id).then(function(client) {
  // 返されたクライアントで何かをします
});

パラメーター

id

取得するクライアントの id を表す DOMString

戻り値

Client オブジェクトまたは undefined に解決される Promise

self.clients.get(id).then(function(client) {
  self.clients.openWindow(client.url);
});

仕様

Specification
Service Workers
# clients-get

ブラウザーの互換性

BCD tables only load in the browser