ember.jssingle-page-applicationhottowel

emberjs "loading screen" at the beginning


I don't know, if you have seen this demo-app yet: http://www.johnpapa.net/hottowel/ but once you start it, you see a really nice loading screen at the beginning like you would in any bigger desktop application/game.

So I haven't had the chance to go through the code properly myself, but I have started recently with Emberjs and I have the feeling that loading all the js-code for the whole SPA that I am building could be in the seconds area.

My question now, how would such a loading screen be possible with emberjs? Or would there be a better way to go about that? (I somehow don't think requirejs would be a solution, though I could be wrong)


Solution

  • you can do something like this:

    App = Ember.Application.create({
      ready: function () {
        $("#loader").remove();
      }
    });
    

    in your body you set something like this

    <img src="img/loading.gif" id="loader">