草案
此页面不完整。

index 只读特性在 ServiceWorkerRegistration interface returns a reference to the ContentIndex interface, which allows for indexing of offline content.

句法

var contentIndexObject = ServiceWorkerRegistration.index;
					

A ContentIndex 对象

范例

You can access the property from either your main script or the registered service worker.

Here is an example from the main script:

// reference registration
const registration = await navigator.serviceWorker.ready;
// feature detection
if ('index' in registration) {
  // Content Index API functionality
  const contentIndex = registration.index;
}
					

service worker :

// service worker script
const contentIndex = self.registration.index;
					

规范

规范 状态 注释
未知
The definition of 'index' in that specification.
未知 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

No compatibility data found. Please contribute data for "api.ServiceWorkerRegistration.index" (depth: 1) to the MDN 兼容性数据存储库 .

另请参阅

元数据

  • 最后修改: