addEventListener("install", (event) => {
event.addRoutes({
condition: {
urlPattern: "/articles/*",
runningStatus: "not-running",
},
source: "network",
});
});InstallEvent: addRoutes() method / notebook
InstallEvent: addRoutes() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
addEventListener("install", (event) => {
event.addRoutes({
condition: {
urlPattern: "/form/*",
requestMethod: "post",
},
source: "network",
});
});addEventListener("install", (event) => {
event.addRoutes({
condition: {
or: [{ urlPattern: "*.png" }, { urlPattern: "*.jpg" }],
},
source: {
cacheName: "pictures",
},
});
});addEventListener("install", (event) => {
event.addRoutes(
{
condition: {
urlPattern: "*.png",
requestMethod: "get",
},
source: {
cacheName: "pictures",
},
},
{
condition: {
urlPattern: "*.jpg",
requestMethod: "get",
},
source: {
cacheName: "pictures",
},
},
);
});