Preload Subscriptions without iron-router


#1

Hi all,

What would be the best way to preload a few subscriptions that I are necessary throughout my whole application?
I used to do it with a waitOn call (Iron Router), but that is quite “passé” now :smile: (using FlowRouter now)

Should I use template level subscriptions on my general layout template and then show a loader that way? Or just a Meteor.startup (but how to show a loader?)?

Thanks a lot.


#2

If you would like to be able to wait for Template.subscriptionsReady() to show a loading spinner or something, then putting subscriptions in your layout template would work best. But if you don’t care about that, you could also do a null publish and you won’t have to subscribe to it at all:

Meteor.publish(null, function () {
    return Whatever.find({});
});

#3

Thanks! Didn’t know you could do a null publication. Will go for the template layout way.