Learning Progressive Web Apps: Building Modern Web Apps Using Service Workers

Book description

Use Service Workers to Turbocharge Your Web Apps

“You have made an excellent decision in picking up this book. If I was just starting on my learning path to mastery of Progressive Web Apps, there are not many folks I would trust more to get me there than John.”

—Simon MacDonald, Developer Advocate, Adobe

Software developers have two options for the apps they build: native apps targeting a specific device or web apps that run on any device. Building native apps is challenging, especially when your app targets multiple system types—i.e., desktop computers, smartphones, televisions—because user experience varies dramatically across devices.

Service Workers—a relatively new technology—make it easier for web apps to bridge the gap between native and web capabilities. In Learning Progressive Web Apps, author John M. Wargo demonstrates how to use Service Workers to enhance the capabilities of a web app to create Progressive Web Apps (PWA). He focuses on the technologies that enable PWAs and how to use those technologies to enhance your web apps to deliver a more native-like experience.

  • Build web apps a user can easily install on their local system and that work offline or on low-quality networks

  • Utilize caching strategies that give you control over which app resources are cached and when

  • Deliver background processing in a web application

  • Implement push notifications that enable an app to easily engage with users or trigger action from a remote server

Throughout the book, Wargo introduces each core concept and illustrates the implementation of each capability through several complete, operational examples. You’ll start with simple web apps, then incrementally expand and extend them with state-of-the-art features. All example source code is available on GitHub, and additional resources are available on the author’s companion site, learningpwa.com.

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.

Table of contents

  1. Cover Page
  2. About This eBook
  3. Half Title Page
  4. Title Page
  5. Copyright Page
  6. Dedication Page
  7. Contents
  8. Foreword
  9. Preface
  10. Acknowledgments
  11. About the Author
  12. 1. Introducing Progressive Web Apps
    1. First, a Little Bit of History
    2. PWAs Are . . .
    3. Making a Progressive Web App
    4. PWA Market Impact
    5. PWAs and App Stores
    6. Wrap-Up
  13. 2. Web App Manifest Files
    1. Save to Home Screen
    2. Making a Web App Installable
    3. Anatomy of a Web App Manifest
    4. Controlling the Installation Experience
    5. Preparing to Code
    6. App Installation in Action
    7. Troubleshooting
    8. Manifest Generation and More
    9. Wrap-Up
  14. 3. Service Workers
    1. PWA News
    2. Introducing Service Workers
    3. Preparing to Code
    4. Registering a Service Worker
    5. Service Worker Scope
    6. The Service Worker Lifecycle
    7. Wrap-Up
  15. 4. Resource Caching
    1. Service Worker Cache Interface
    2. Preparing to Code
    3. Caching Application Resources
    4. Implementing Additional Caching Strategies
    5. Wrap-Up
  16. 5. Going the Rest of the Way Offline with Background Sync
    1. Introducing Background Sync
    2. Offline Data Sync
    3. Choosing a Sync Database
    4. Preparing to Code
    5. Enhancing the PWA News Application
    6. Wrap-Up
  17. 6. Push Notifications
    1. Introducing Push Notifications
    2. Remote Notification Architecture
    3. Preparing to Code
    4. Generating Encryption Keys
    5. Validating Notification Support
    6. Checking Notification Permission
    7. Getting Permission for Notifications
    8. Local Notifications
    9. Notification Options
    10. Subscribing to Notifications
    11. Unsubscribing from Notifications
    12. Remote Notifications
    13. Dealing with Subscription Expiration
    14. Sending Notifications to Push Services
    15. Wrap-Up
  18. 7. Passing Data between Service Workers and Web Applications
    1. Preparing to Code
    2. Send Data from a Web App to a Service Worker
    3. Send Data from a Service Worker to a Web App
    4. Two-Way Communication Using MessageChannel
    5. Wrap-Up
  19. 8. Assessment, Automation, and Deployment
    1. Assessing PWA Quality Using Lighthouse
    2. Preparing to Code
    3. PWABuilder
    4. PWAs and the Microsoft Store
    5. Wrap-Up
  20. 9. Automating Service Workers with Google Workbox
    1. Introducing Workbox
    2. Generating a Precaching Service Worker
    3. Add Precaching to an Existing Service Worker
    4. Controlling Cache Strategies
    5. Wrap-Up
  21. Index
  22. Credits
  23. Code Snippets

Product information

  • Title: Learning Progressive Web Apps: Building Modern Web Apps Using Service Workers
  • Author(s): John M. Wargo
  • Release date: March 2020
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780136485674