[workbox-window] New messageSkipWaiting() method #2394
Labels
Feature Request
Good First Issue
This would be an ideal issue for a new contributor to take on.
workbox-window
Milestone
There's a subtle way that the "Offer a page reload for users" recipe can go wrong, in that the
could, under some circumstances, end up sending that message to the already-
active
service worker, not the service worker that's currently in thewaiting
state.After discussing with @philipwalton, we're going to keep the
messageSW()
behavior the same (it will always callpostMessage()
on the service worker instance associated with theWorkbox
object), and instead come up with a new method—my proposed name ismessageSkipWaiting()
—that will be equivalent to usingmessageSW(sw, {type: 'SKIP_WAITING'})
with thesw
parameter set to whatever the currentlywaiting
service worker is.We can then update the recipe to read
and it should behave as intended.
The text was updated successfully, but these errors were encountered: