Clients: matchAll() メソッド
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
matchAll()
は Clients
インターフェイスのメソッドで、サービスワーカークライアント(Client
)オブジェクトのリストの Promise
を返します。 関連するサービスワーカーのオリジンと同じオリジンを持つすべてのサービスワーカークライアントを返すには、options
引数を含めます。 オプションが含まれていなかった場合、このメソッドは、サービスワーカーによって制御されるサービスワーカークライアントのみを返します。
構文
matchAll()
matchAll(options)
引数
options
省略可-
照合操作のオプションを設定できるオプションオブジェクト。 利用可能なオプションは次のとおりです。
includeUncontrolled
-
論理値です。
true
に設定すると、照合操作は、現在のサービスワーカーと同じオリジンを共有するすべてのクライアントを返します。 それ以外の場合は、現在のサービスワーカーによって制御されているサービスワーカークライアントのみを返します。 既定値はfalse
です。 type
-
照合するクライアントの種類を設定します。 使用可能な値は、
"window"
、"worker"
、"sharedworker"
、"all"
です。 既定値は"window"
です。
返値
例
clients.matchAll(options).then((clientList) => {
for (const client of clientList) {
if (client.url === "index.html") {
clients.openWindow(client);
// または、一致するクライアントに関係する何かを行う
}
}
});
仕様書
Specification |
---|
Service Workers # clients-matchall |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
matchAll | ||||||||||||
options.includeUncontrolled parameter |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- See implementation notes.
- Has more compatibility info.