Skip to content

Experimenting with progressive web applications.

Notifications You must be signed in to change notification settings

saradalsman/pwa-test

 
 

Repository files navigation

PWA test

Links

Running

Prerequisite

# Dependencies
npm install
# Only required for testing the production build locally
npm install -g serve

Start

# Dev environment
npm run dev
# Build prod
npm run build

# Test prod locally
serve -l 8000 docs

Deploy

Since we are using gh-pages, every push is a deployment. However only the /docs folder is served. Therefor a production build is required before the push.

npm run build
git add docs
git commit -m "Deploy production build"
git push

Live site

The live site is hosted on github pages. https://pirfalt.github.io/pwa-test/

Gotchas

Turns out that when you call navigator.serviceWorker.register('service-worker.js) the request for service-worker.js isn't intercepted by any service worker's fetch event handler.

Since that request is not handled by the service worker the service worker itself is always requested from the server. Which leads to at least one request to the server every time, completely negating the offline capability 😭.

However that special request does respect the http caching headers. So that "completely negating the offline capability" is not actually true 😅. But rather, offline capability only works for as long as the service worker does not need to be re-fetched. Meaning at most until the cache time expires or the file is evicted by the browser.

TODO

About

Experimenting with progressive web applications.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.9%
  • TypeScript 30.1%
  • CSS 9.8%
  • HTML 8.2%