How a progressive web application differs from a regular web application in terms of performance

I read about a progressive web application, pwa uses a service worker for offline caching to speed things up. But why can't I use localstorage for the same purpose as a working service? so if we don’t get a response from the api request, we can load data from local storage. And the usual browser cache for assets?

maybe this is a stupid question, but still thinking to ask a question. Any advice was appreciated.

+4
source share
2 answers

First of all, the service worker starts in another thread, and then in the main application. why you can use a service worker to increase productivity, because these operations will not affect the main application.

You can use localstorage to store data on the client side, but you cannot use it for offline caching. To get data from local storage, you first need to download a script that will try to access local storage.

SeriveWorkers are also stored in the client, and they can intercept the network layer. Thus, in your worker, you can decide whether you want to first load a specific route from the cache or try to request it from the network.

, : https://www.youtube.com/watch?v=OBfLvqA_E4A

+6

localStorage, , . 6-7 . https://love2dev.com/blog/use-local-storage-to-make-your-single-page-web-application-rock/ , localStorage . IndexedDB. IDB Safari IE. IDB. -, Safari, . , , . - appCache . FYI, - , appCache, -. appCache . .

PWA.

0

Source: https://habr.com/ru/post/1678877/


All Articles