Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Use a no-op Service Worker in Development


    Having to manually unregister the Service Worker and clean the cache after you finish testing a Service Worker is ok, but at some point you’d rather automate it.

    ServiceWorkerRegistration.unregister() can only be used within a registration and it doesn’t clean the cache, making it useless for the case.

    However, using a no-operation (no-op) service worker will override the already registered one and remove the cache, leaving it in a clean slate.

    The lesson shows how to automated this by creating a no-op Service Worker to use on development.