0

I have own module system for internal WEB application - major concept is that application is dynamic, i.e. modules can be added/removed at run-time. Because of this reason I cannot use bundling and separate modules are loaded individually. Requesting one single module can cause loading of 100 other as dependencies - current implementation with own loader makes this asynchronously and renders nice progress bar so that users on slow connection have idea how long they need to wait.

Currently I'm evaluating alternative to switch to ES6 syntax for modules as well as switch to some of ES6-compatible module loader existing on github.

So the question is - are there ES6-compatible module loaders with API that provides events saying something like:

  • I started loading resources
  • I've loaded N of M resources
  • I've done with loading of all requested resources

This has to run at least in following browsers: Chrome (latest), Firefox (latest), IE11.

Xtra Coder
  • 3,389
  • 4
  • 40
  • 59
  • Don't all browser by default show the progress of loading ressources in the address bar? – Bergi Feb 24 '16 at 22:13
  • I would say only some of browsers show progress bar for resources (I remember Opera had it, last used it 2-3 years ago), none of the ones I have in project requirements have it - Chrome (latest), Firefox (latest), IE11 – Xtra Coder Feb 25 '16 at 06:28

1 Answers1

0

I would recommend to transpile ES6 modules to AMD, and use an AMD module loader that supports the features you need. For example, the Dojo implementation seems to have tracing events.

Alternatively, irrespective of the used module loader you might be able to track the loading of module resources using the resource timing API. It doesn't seem to fire events, but you should be able to poll it.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375