Building Custom Response Objects

preview_player
Показать описание
If you have ever needed to cache a local file, or generate a file and save it in a cache... If you have ever used a Service Worker and you needed to send a custom response back to the browser... If you were building an offline-first PWA and needed to create HTTP Response objects...
Then this is the tutorial you need.

0:00 Concepts and Purpose
2:03 Response Objects
4:05 JSON responses
9:30 Image responses
Рекомендации по теме
Комментарии
Автор

I have read the MDN article about five times, and I still hadn't understood why one needs to clone(). Really helpful video!

UliTroyo
Автор

it is a crime you don't have 1M subs. Thx a ton.

oah
Автор

Thanks! This tutorial came just at the right time! Very clear instruction as always

marie-elizeventer
Автор

@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.

leolowe
Автор

so doing this is a fall back when your backend is down?...

johnm