Vulcan/lib/router/config.js
2014-11-17 14:45:23 +09:00

37 lines
1.3 KiB
JavaScript

// uncomment to disable FastRender
var FastRender = {RouteController: RouteController, onAllRoutes: function() {}};
//--------------------------------------------------------------------------------------------------//
//--------------------------------------------- Config ---------------------------------------------//
//--------------------------------------------------------------------------------------------------//
preloadSubscriptions.push('settings');
preloadSubscriptions.push('currentUser');
Router.configure({
layoutTemplate: getTemplate('layout'),
loadingTemplate: getTemplate('loading'),
notFoundTemplate: getTemplate('notFound'),
waitOn: function () {
return _.map(preloadSubscriptions, function(sub){
// can either pass strings or objects with subName and subArguments properties
if (typeof sub === 'object'){
Meteor.subscribe(sub.subName, sub.subArguments);
}else{
Meteor.subscribe(sub);
}
});
}
});
// adding common subscriptions that's need to be loaded on all the routes
// notification does not included here since it is not much critical and
// it might have considerable amount of docs
if(Meteor.isServer) {
FastRender.onAllRoutes(function() {
var router = this;
_.each(preloadSubscriptions, function(sub){
router.subscribe(sub);
});
});
}