Service Workies chapter 2 is released and ready to play!
In chapter 1 the game gently introduces you to the hardest part about Service Worker — the lifecycle. When Service Workers get created, updated, and terminated. What waiting
vs active
is all about.
In chapter two we build on this foundation and dive into reacting to the Service Worker lifecycle.
When building a PWA and learning Service Worker it can be super tempting to jump straight to the big wins of caching. But in the words of a wise Workie:
Strong walls can only be built on top of strong ground.
— Lani
We'll cover working with caches in excruciating detail in chapter 4. But first you need to know how to detect when a Service Worker has been successfully installed. Know when it moves on to its activated
state. Know how to access its state and detect when it changes.
This chapter also introduces the Service Worker Registration, and some neat things you can do with it like getting references to the various installed Service Workers.
Lani also teaches you about the powerful but risky skipWaiting()
command.
Kolohe gets pretty fed up with the Crow. You're going to have to help him face down the beast using everything learned up to this point.
I'm excited about something new I started doing in Chapter 2 — using an advanced state machine for the boss fight. There are multiple checkpoints where you'll probably fail and watch poor Kolohe 'splode. This level is intentionally hard. When you fail and can't remember the answer, go back and replay the level that teaches the thing you forgot. This will help drill the concepts into your brain. I'll write more about state machines later because I think they have sooo much potential for UI development.
Good luck, have fun!
PWAs are the future of web apps. At their very heart is the powerful but devious Service Worker. Learn to control it inside and out, and make your web app compete with the very best of native.Master Service Workers