Get start-up progress of Aurelia?

760 Views Asked by At

Aurelia loads quite a bit on start up. I notice you can specify when Aurelia starts-up and that it will return a Promise.

aurelia.start().then(a => a.setRoot('app', document.body));

Its not clear to me if it is possible to hook into the promise to figure out how many tasks there are and when each completes?

So my question is: Is it possible deduce the progress of Aurelia's loading? Say, for example, if you wanted to set the percentage of a Progress bar?

2

There are 2 best solutions below

4
On BEST ANSWER

Most of Aurelia's loading time is SystemJS loading files from the server. Presumably, you will be bundling for production so I believe the correct way to show a loading bar would be to monitor the progress of the bundle request and display that.

I don't believe Aurelia has a concept of loading time because under the hood, Aurelia isn't really waiting on a set of things, it just requests things as it needs them and some of those come from the remote server.

0
On

I solved the problem by adding a small JavaScript in the index.html which checks how many require modules were loaded. It works like a charm. Please check the how-to and example here:

http://www.kopf.com.br/kaplof/a-real-loading-indication-for-aurelia-and-requirejs/

Cheers