0

I'm new to ES6, and I'm struggling to import a notification module "toaster-js" to my "sw-toolbox" (service worker cache API) script.

Specifically I want to alert the end user when a cache download has finished, and my PWA is available for offline browsing.

I can't figure out where to stick

import { Toast } from "toaster-js";

without incurring various syntax errors, mainly "import declarations may only appear at top level of a module" and "Unexpected token {"

If I try loading it through html by declaring <script type="module" [...]>, then the relevant handlers aren't recognized by my sw-toolbox script.

Any pointers would be much appreciated!

Thanks

  • https://stackoverflow.com/questions/37624819/es2015-import-doesnt-work-even-at-top-level-in-firefox – earlonrails Sep 28 '18 at 16:32
  • Possible duplicate of [ES2015 import doesn't work (even at top-level) in Firefox](https://stackoverflow.com/questions/37624819/es2015-import-doesnt-work-even-at-top-level-in-firefox) – earlonrails Sep 28 '18 at 16:33

0 Answers0