ServiceWorkerRegistration.index

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

indexServiceWorkerRegistration インターフェイスの読み取り専用プロパティで、オフラインコンテンツの索引付けができる ContentIndex (en-US) インターフェイスへの参照を返します。

ContentIndex (en-US) オブジェクトです。

このプロパティはメインスクリプトと登録済みサービスワーカーのどちらからでもアクセスできます。

ここでは、メインスクリプトからアクセスする例を示します。

js
// reference registration
const registration = await navigator.serviceWorker.ready;

// feature detection
if ("index" in registration) {
  // Content Index API functionality
  const contentIndex = registration.index;
}

サービスワーカーからの呼び出し例です。

js
// service worker script

const contentIndex = self.registration.index;

仕様書

Specification
Content Index
# dom-serviceworkerregistration-index

ブラウザーの互換性

BCD tables only load in the browser

関連情報