blob: 1121a9247410c0ad01954f7cd52d2f8fe320fbfe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
if(!Package['meteorhacks:fast-render']) {
return;
}
FastRender = Package['meteorhacks:fast-render'].FastRender;
// hack to run after eveything else on startup
Meteor.startup(function () {
Meteor.startup(function () {
setupFastRender();
});
});
function setupFastRender () {
_.each(FlowRouter._routes, function (route) {
FastRender.route(route.pathDef, function (routeParams, path) {
var self = this;
// anyone using Meteor.subscribe for something else?
var original = Meteor.subscribe;
Meteor.subscribe = function () {
return _.toArray(arguments);
};
route._subsMap = {};
FlowRouter.subscriptions.call(route, path);
if(route.subscriptions) {
var queryParams = routeParams.query;
var params = _.omit(routeParams, 'query');
route.subscriptions(params, queryParams);
}
_.each(route._subsMap, function (args) {
self.subscribe.apply(self, args);
});
// restore Meteor.subscribe, ... on server side
Meteor.subscribe = original;
});
});
}
|