Service Workers API
The getRegistrations() method of the
ServiceWorkerContainer interface gets all
ServiceWorkerRegistrations associated with a
ServiceWorkerContainer, in an array. The method returns a
Promise that resolves to an array of
ServiceWorkerRegistration.
Syntax
getRegistrations()
Parameters
None.
Return value
A Promise that resolves to an array of ServiceWorkerRegistration objects.
Examples
navigator.serviceWorker.getRegistrations().then((registrations) => {
document.querySelector("#status").textContent =
"ServiceWorkerRegistrations found.";
});
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
