- From: James Browning <notifications@github.com>
- Date: Mon, 22 Feb 2021 20:58:38 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 23 February 2021 04:58:51 UTC
Actually I realised the above could be accomplished with the [module blocks proposal](https://github.com/tc39/proposal-js-module-blocks), e.g. the service worker would not become active until all imports in all module blocks had also fetched. Then `import()` would only accept module blocks e.g.: ```js // We can dynamically import module blocks only const moduleWithTLA = module { // Before becoming the active service worker, this graph must successfully fetch // and parse export * from "./moduleWithTLA.js"; } self.addEventListener("some-event", async (evt) => { evt.waitUntil(async () => { // Is a module block so allowed const { someExport } = await import(moduleWithTLA); // Is a string so not allowed await import("some-string"); }); }); ``` -- 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/1407#issuecomment-783877361
Received on Tuesday, 23 February 2021 04:58:51 UTC