Search code examples
service-workerworkbox

What is the differences between ServiceWorker and Workbox?


I'm beginner on ServiceWorker. Today I saw this website : https://developers.google.com/web/tools/workbox

But I still have no idea what it is. Is this a library that help me make SW with easier way? Or, Is this another way to make PWA without SW?

What could be precise definition of "Workbox"?


Solution

  • It is a library for working with Service Workers. But not only Service Workers, but also other things considering Progressive Web Apps such as manifest.json files.

    The page you linked says:

    Why Workbox?
    Workbox is a library that bakes in a set of best practices and removes the boilerplate every developer writes when working with service workers.
    
    Precaching
    Runtime caching
    Strategies
    Request routing
    Background sync
    Helpful debugging
    Greater flexibility and feature set than sw-precache and sw-toolbox
    

    which is a good definition.

    Workbox will either:

    • help you with library provided utilities when you're writing a Service Worker by hand (manually)
    • take in a config and generate a Service Worker for you