[w3c/ServiceWorker] How can I pass or post params to sevirce worker on register or install? (#1441)

Hi all,
I have a multi lingual website and my assets (js, css, fonts) are versioned (e.g. js-3.1.7/lib/file.js).
I've tried to use after serviceWorker.register to postMessage({comand:"install",version:"3.1.7", language:"en"}), and in sw.js to add an event listener for message. In that event I check for the comand. Then I try in the event listener for install to build my assets to cache, e.g.
- js-{version}/lib/file.js
- js-{version}/locale/locale-{language}
and my cache name should become
- "cache-{version}" for the cacheApi.

But it won't work. I think the event listener for message is not fired when install /register is fired?

How can I fix this. URL-Searchparams may be not a good alternative, because with search params I may register new sw on each language change?

Many thanks.
Michael

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1441

Received on Sunday, 23 June 2019 21:16:14 UTC