【发布时间】:2013-06-17 18:40:30
【问题描述】:
我通过各种自动运行设置了多个订阅。能够查看在任何给定时间处于活动状态的订阅对于调试目的很有用。这可能吗?
【问题讨论】:
标签: meteor
我通过各种自动运行设置了多个订阅。能够查看在任何给定时间处于活动状态的订阅对于调试目的很有用。这可能吗?
【问题讨论】:
标签: meteor
作为对上述内容的补充,我们可以对它们进行一些组织,以便更容易检查多个订阅等。
//all the subscriptions that have been subscribed.
var subs = Meteor.default_connection._subscriptions;
var subSummary = {};
// organize them by name so that you can see multiple occurrences
Object.keys(subs).forEach(function(key) {
var sub = subs[key];
// you could filter out subs by the 'active' property if you need to
if (subSummary[sub.name] && subSummary[sub.name].length>0) {
subSummary[sub.name].push(sub);
} else {
subSummary[sub.name] = [sub];
}
});
console.log(subSummary);
请注意,您可以看到“就绪”状态,以及订阅中使用的参数。
【讨论】:
对“有效”订阅一无所知。
但是有一个对象Meteor.default_connection._subscriptions 存储了在给定时间之前已订阅的所有订阅的信息。
var subs = Meteor.default_connection._subscriptions; //all the subscriptions that have been subscribed.
Object.keys(subs).forEach(function(key) {
console.log(subs[key]); // see them in console.
});
虽然不是你想要的。
【讨论】:
Meteor.default_connection 未定义。知道为什么吗?