Skip to content

Commit

Permalink
fix: Apply changes for service-worker API
Browse files Browse the repository at this point in the history
  • Loading branch information
FunMiles committed Jul 6, 2022
1 parent 01288c9 commit 93db501
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/service-worker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { build, files, timestamp } from '$service-worker';
import { build, files, version } from '$service-worker';
import { precacheAndRoute, precache } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import {StaleWhileRevalidate} from 'workbox-strategies';
import { StaleWhileRevalidate } from 'workbox-strategies';

declare let self: ServiceWorkerGlobalScope

Expand All @@ -22,23 +22,23 @@ precacheAndRoute([
...files.map(f => {
return {
url: f,
revision: `${timestamp}`
revision: `${version}`
}
})
]);

// Edit the list of routes so they get cached and routed correctly, allowing
// cold start or hot reload to work offline.
const skRoutes = [ '/', '/about', '/todos' ];
const skRoutes = ['/', '/about', '/todos'];

precache( skRoutes.map(f => {
precache(skRoutes.map(f => {
return {
url: f,
revision: `${timestamp}`
revision: `${version}`
}
}) );
}));

const matchCb = ({url, request, event}) => {
const matchCb = ({ url, request, event }) => {
return skRoutes.some(path => url.pathname === path);
};
registerRoute(matchCb, new StaleWhileRevalidate({}));
Expand Down

1 comment on commit 93db501

@vercel
Copy link

@vercel vercel bot commented on 93db501 Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sveltekit-pwa – ./

sveltekit-pwa-funmiles.vercel.app
sveltekit-pwa.vercel.app
sveltekit-pwa-git-main-funmiles.vercel.app

Please sign in to comment.