次の2つのコードブロックとの違いは何ですか?上部は期待どおりに機能しますが、下部は機能しません。
// Initially outputs 0, but eventually outputs the # of players.
Meteor.autorun(function() {
var players = Players.find();
console.info(players.count());
});
// Outputs 0 twice. Why does this not work like the block above?
var players = Players.find();
Meteor.autorun(function() {
console.info(players.count());
});
Meteor.isClientブロック内のリーダーボードの例でこれをテストしています。
ありがとう、アンドリュー