内容简介:“A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features that don’t need a web page or user interaction. Today, they already include features likeIn this blog post, I’ll focus on another
“A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features that don’t need a web page or user interaction. Today, they already include features like push notifications and background sync . In the future, service workers might support other things like periodic sync or geofencing.” — The Offline Cookbook
In this blog post, I’ll focus on another exciting service workers feature — intercepting and caching network requests.
Caching is one of the most exciting features of SWs. It enables us to deliver our users with a responsive and stable native-app-like experience. A web app can display some content, and perform some function, in bad network conditions and even when the user is completely offline.
We’ll cover five different caching strategies. We’ll see how and when you should implement each of them.
- Stale-While-Revalidate
- Cache first, then Network
- Network first, then Cache
- Cache only
- Network only
I’ll address each strategy with an example to help you better understand it. You will also learn when and where to use them in your PWAs, and some assets you can use them with.
以上所述就是小编给大家介绍的《5 Service Worker Caching Strategies for Your Next PWA App》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Head First 设计模式(中文版)
弗里曼 / O'Reilly Taiwan公司 / 中国电力出版社 / 2007-9 / 98.00元
《Head First设计模式》(中文版)共有14章,每章都介绍了几个设计模式,完整地涵盖了四人组版本全部23个设计模式。前言先介绍这本书的用法;第1章到第11章陆续介绍的设计模式为Strategy、Observer、Decorator、Abstract Factory、Factory Method、Singleton,Command、Adapter、Facade、TemplateMethod、I......一起来看看 《Head First 设计模式(中文版)》 这本书的介绍吧!