DEV Community

Discussion on: Explain how service workers work like I'm five

Collapse
 
aswathm78 profile image
Aswath KNM

Think browser as a shop owner .

Whenever you request items , he will buy it from the maker and give it to you .

But in some cases what if the manufacturer is not available ?(Internet Down)

That's why the manufacturer will say "Hey Buddy ! I will give you some basics that every customer want But alert me for any specific order "

So that time , when you ask for a product the shopkeeper delivers it from his warehouse . But you won't know the difference where it came from

He'll deliver as long as available .

So The manufacturer is the server like google,amazon etc...

The shop keeper is your browser

The site which says save some very basic content like start page , end page etc mentioned in a page called service worker

Simply service worker is a manual from the server to the browser to which assets to download and what to do when a specific url is request(irrespective of your internet connection)

Try 2048

Its also a Progressive web app with service workers implemented and works offline when you go to that url