A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://developer.mozilla.org/ja/docs/Web/API/WindowClient below:

WindowClient - Web API | MDN

WindowClient

Baseline Widely available *

WindowClient はサービスワーカー API のインターフェイスで、アクティブなワーカーによって制御される閲覧コンテキスト内のドキュメントである、サービスワーカークライアントのスコープを表します。 サービスワーカークライアントは、それ自身の読み込みとサブリソースに対してサービスワーカーを個別に選択して使用します。

Client WindowClient インスタンスメソッド

WindowClient には、親インターフェイスである Client から継承したメソッドがあります。

WindowClient.focus()

現在のクライアントにユーザー入力フォーカスを与えます。

WindowClient.navigate()

指定された URL を制御されたクライアントのページに読み込みます。

インスタンスプロパティ

WindowClient には、親インターフェイスである Client から継承したプロパティがあります。

WindowClient.focused 読取専用

論理値で、現在のクライアントにフォーカスがあるかどうかを示します。

WindowClient.visibilityState 読取専用

現在のクライアントの可視性を示します。 この値は、"hidden"、"visible"、"prerender" のいずれかです。

例
self.addEventListener("notificationclick", (event) => {
  console.log("On notification click: ", event.notification.tag);
  event.notification.close();

  // これは、クライアントが既に開いているかどうかを確認し、
  // 開いている場合にフォーカスを合わせます
  event.waitUntil(
    clients
      .matchAll({
        type: "window",
      })
      .then((clientList) => {
        for (const client of clientList) {
          if (client.url === "/" && "focus" in client) {
            client.focus();
            break;
          }
        }
        if (clients.openWindow) return clients.openWindow("/");
      }),
  );
});
仕様書 ブラウザーの互換性 関連情報

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4