@slightlylate hey Alex. Any suggestions on this by any chance? Not quite sure what the best way would be to go about this, I'd appreciate your input if you have time:https://twitter.com/HenrikJoreteg/status/1012400177569673219 …
-
-
Replying to @HenrikJoreteg
Delaying activation is interesting. Today, that's accomplished by keeping a client (window/tab) around and enabling you to bail out of installation by throwing an error in the `install` event.
1 reply 0 retweets 0 likes -
Replying to @slightlylate @HenrikJoreteg
I'd be using the install event rejection to make this happen, as you'd still be able to do things like prep the caches for the next version to take over at some future point. Because versions can "see" each other, you can ping the active version to ask "is now a good time?"
1 reply 0 retweets 1 like -
Replying to @slightlylate
hm... that's really interesting. I'm trying to make sure I understand you. So you're saying the install event, you'd intentionally throw an error if it wasn't a good time?
1 reply 1 retweet 0 likes -
Replying to @HenrikJoreteg
Correct. You'd feed a rejection to the waitUntil promise at the very end of the chain.
2 replies 1 retweet 0 likes -
Replying to @slightlylate
Did you see Jake's suggestion? He said to post a message from the app (that's still being controlled by old worker) to the new waiting worker to skip waiting if it was a good time. Do you see any advantage/disadvantage of either approach?
1 reply 0 retweets 0 likes -
Replying to @HenrikJoreteg
That presumes you won't ever close/reopen all existing tabs in the session. If you have to include that case, then your options are more limited.
3 replies 0 retweets 2 likes -
Replying to @slightlylate
So, let's say you've rejected the install because it was a bad time. What would you do at the point where you explicitly wanted to try to switch to the newer version? But if you've rejected the install, it's not ready to go yet. So would you call "update" manually from the app?
1 reply 0 retweets 0 likes
we have an "update()" method which gives you a moment to retry manually but async:https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/update …
-
-
Replying to @slightlylate
Right, that's what I was referring to I guess I'd call .update() then wait a bit to see if you get "controllerchanged" event. And if not, just assume there's nothing new?
1 reply 0 retweets 0 likes -
Replying to @HenrikJoreteg
New version can `postMessage` you as it's installing to give you notice about progress. Protocol is yours to define from there (sorry!)
1 reply 0 retweets 0 likes - 4 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.