![]() The Google team also included some strategies in their "Offline Cookbook." Let's dive straight into the contents and analyze them using the example of the Twitter app and fetching tweets. But before you start the implementation, consider a strategy of serving data that will best fit your needs. This option allows you to build middleware for every request done in the app. SW also offers the fetchevent, for changes that might happen more often and less predictably. Well, SW gives you the installevent, fired only once in the SW life cycle, so you can use it if there’s almost no possibility of this data changing in the future or changing along with the SW version. ![]() ![]() It's intended for not just static files from the app, but also external resources, like the backend API.ĭoes it mean that you can use the Cache API alongside SW to store dynamic data? ![]() Reach out to us and we'll gladly put you in contact with one of our experts on the subject.Īs I already mentioned in my previous post about static data, you can save files as a request-response pair in the cache by using the Cache API. You can use them separately or mix them up, it's up to you. There are several ways of handling this type of data in offline mode, and below I’ll briefly outline a few, each of which addresses a different behavior of the app. In this article, I will show you how to store, update, and synchronize data between your application and a server, drawing on some specific use cases and real-life solutions.įirst, let’s go one more time over what dynamic data is-imagine an app like Twitter as a Progressive Web App example.Īside from static data that you can store in the cache, what else can you find there? Posts, users, comments, likes, and a lot more information that changes over time–dynamic data, in other words. Yet, achieving full offline support for your app involves more than just caching, and now it's time to show you something more advanced, namely handling dynamic data offline. As you probably remember from my previous post on making your Progressive Web App work offline, storing static files in the cache can be of great help when there’s no Internet connection available.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |