草案
此页面不完整。
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. |
未知 | 初始定义。 |
No compatibility data found. Please contribute data for "api.ServiceWorkerRegistration.index" (depth: 1) to the MDN 兼容性数据存储库 .
Content Index API