Syntax
js
waitUntil(promise)
Parameters
Return value
None (undefined).
Examples
Using waitUntil() within a service worker's install event:
js
addEventListener("install", (event) => {
const preCache = async () => {
const cache = await caches.open("static-v1");
return cache.addAll(["/", "/about/", "/static/styles.css"]);
};
event.waitUntil(preCache());
});
Specifications
| Specification |
|---|
| Service Workers Nightly # dom-extendableevent-waituntil |