Konubinix' opinionated web of thoughts

Service Workers

Fleeting

A kind of web worker, see difference between web workers vs service workers vs worklets

See the service-worker/basic of GoogleChrome/samples: A repo containing samples tied to new functionality in each release of Google Chrome.

Use workbox to do it easily.

endpoint to the service-worker.js file is quite important. If the script were served from, say, js/service-worker.js then the ServiceWorker would only be able to intercept requests in the /js context, but it’d be blind to resources like other. This is typically an issue because you usually scope your JavaScript files in a /js, public, assets, or similar “directory”, whereas you’ll want to serve the ServiceWorker script from the domain root in most cases.

https://css-tricks.com/serviceworker-for-offline/

lowest possible barrier to entry with Workbox, the CLI is for you: npm install workbox-cli –save-dev

https://developer.chrome.com/docs/workbox/the-ways-of-workbox

run the wizard with npx workbox wizard

https://developer.chrome.com/docs/workbox/the-ways-of-workbox

CLI can run either generateSW or injectManifest methods for you

https://developer.chrome.com/docs/workbox/the-ways-of-workbox

Notes linking here