|Learning Progressive Web Apps|
Author: John M Wargo
OK, I get the general idea - web apps that are as good as native apps - but I'm not at all clear what technology this is. Progressive Web Apps aren't really like earlier web innovations where there was a clear-ish toolkit of parts that you could use to put together something that looked better than just a web page. I suppose you could say that if Ajax was about XMLHttpRequest, PWA is about Service workers. However, PWA seems to be about a lot more than just Service workers - its almost a philosophy.
So enter this particular book, which is reasonably up-to-date, something that is is important for a fast moving subject like PWA. It starts off with a look at the history and philosophy and I have to say that like most accounts of the same topic it left me with that warm fuzzy feeling I get after reading any motivational "do it right" text. It does warn that PWAs are universally accepted and what you have to do to get things to work might vary according to browser and platform, but perhaps not enough. You need to keep in mind that while Microsoft and Google see no harm in PWAs and are trying to support them, Apple sees them as an attack on the App Store and its revenue and so its support is slower, patchier and more suspect.
The second chapter gets down to more practical matters and it starts where I think the topic should start - the manifest. Many books leave this till the end because it is considered to be an issue of deployment, and hence something you do after you have finished everything else. The web manifest is one of the reasons PWAs can look like native apps and they are problematic as not all web browsers support the same features. This situation is getting better, but you need to explore the manifest before you set out on creating a PWA.
Chapter 3 is also on topic and well timed - the service worker. Other aspects of PWA might be optional, but it is difficult to see how you can create the offline experience needed without a Service worker. This is a short, but very reasonable introduction to the service worker where the server side is implemented using Node.js.
After the service worker the logical next topic is caching - it's how the service worker gets data when you are offline. This is the subject of Chapters 4 and 5 with first a basic introduction and then extension to background sync and using a database for offline data. The database used is IndexedDB.
Chapter 6 is about push notifications. which are very attractive but not supported as widely as the other PWA technologies. The chapter doesn't make a lot of fuss about this, but it is worth keeping in mind that Safari currently doesn't support it and might well never support it.
Chapter 7 is about passing data between service workers and the rest of your app - I think this should have been covered earlier as the integration of service and other workers into your main thread is often important and the reader might be thinking that the service worker is isolated in some way.
The final two chapters are a bit off the main topic. Chapter 8 is about how to deal with "meta" concerns such as assessing your code using Lighthouse and deployment. Chapter 9 is about Google's Workbox, which provides a higher level abstraction of the service worker + cache. While this is still a minority interest, I think it is the way that PWAs will go in the future.
To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.
|Last Updated ( Saturday, 26 December 2020 )|