I have read the MDN article about five times, and I still hadn't understood why one needs to clone(). Really helpful video!
@oah84652 жыл бұрын
it is a crime you don't have 1M subs. Thx a ton.
@leolowe228 ай бұрын
@SteveGriffith-Prof3ssorSt3v3 as am I correctly understanding, if we receive some response from the server its always a Response Object and we store it in the CacheAPI, Also to start with on initial load we also access some files on the domain and store it in the CacheAPI and that too are also response objects, and the above scenario is the use case where we have some ui rendered from the caches we may have from earlier connections to the server , it may contain may be a file uploader or an image uploader input, so until the browser establishes connection with the server, we still provide a rich experience to the user to let them use the app perform uploads convert those resources to valid Response objects and store it in the CacheAPI and next time whenever the app goes online again, the same gets persisted on the api server from the Cache API with some persistence approach we can write down with the SW.
@SteveGriffith-Prof3ssorSt3v37 ай бұрын
You can save things in either the Cache API or IndexedDB when offline and then sync to the server when back online. In the CacheAPI you are saving response objects. In the IndexedDB you are saving data like JSON.
@marie-elizeventer70802 жыл бұрын
Thanks! This tutorial came just at the right time! Very clear instruction as always
@anwayarath64532 жыл бұрын
This is awesome.
@johnm83582 жыл бұрын
so doing this is a fall back when your backend is down?...
@MrPaul_O2 жыл бұрын
I think it's more for handling when maybe the client has a limited connection. He mentioned an offline app, as well as caching data responses so that maybe there are less calls to the backend and can be handled by a service worker active in the background.
@SteveGriffith-Prof3ssorSt3v32 жыл бұрын
Service Workers act like Proxy Servers - in between your web page and the web server. They will observer every request that comes from the browser and get to choose what happens. They could forward a request to the web server OR just send a Response that they build. Also, if you want to save something in the Cache, from your web page or from a Service Worker then you need to have a Response object to save.
@MrPaul_O2 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 does that mean you'd use it to store an asset to the browser's cache and your browser can choose not to request\fetch it on subsequent visits? I feel there's already a cache in the browser. Or are you referring to a different scenario\cache?
@SteveGriffith-Prof3ssorSt3v32 жыл бұрын
@@MrPaul_O the browser cache and the cache api are two separate things. kzbin.info/www/bejne/faaTpWV7jJeenLc