5

I built a meteor app with a big background image. Right now the app starts and the user can watch while the image is loading. It would be better for me to load the needed background-image first and if the loading has finished the app will show up. I tried to search for some concepts for that, but I didn't find a solution, which is usable with meteor.

So I thought of using the waitOn-function of the Iron-Router:

Router.route('/', {
    name: 'home',
    yieldRegions: {
        'navigationBar': { to: 'navigation' },
        'contentPage':   { to: 'content' } 
    },
    waitOn: function() { 
         // Loading image, and if loaded, go further on...
    }
});

Maybe someone has a idea how to do that...

user3142695
  • 15,844
  • 47
  • 176
  • 332

1 Answers1

0

Ok. I have spent some time thinking about this already. I was unable to come up with any code sample. But I have started using appcache for meteor and it works like a charm. Appcache is good for users who already have used the app at least once.

Here is the URL : https://atmospherejs.com/meteor/appcache

It allows you to specify if you want to cache a particular image(or any resource) or not.

To preload the image, preload as in preload, there are no packages available for meteor. I have tried using the old dream weaver style image preload , and that kinda works but slows down the app a bit. The i found this

https://github.com/farinspace/jquery.imgpreload

This seems to be a better solution than using plain javascript.

Sak90
  • 600
  • 6
  • 19
  • 1
    I don't think that appcache is doing the right thing for that. It is a great tool for caching, but this isn't the task here... – user3142695 Sep 28 '15 at 23:35