タイマーを作成しようとしていますが、JavaScript ファイルは次のとおりです。
function timer(){
var date = new Date();
Template.pomodoro.timer = function() { return date};
Template.pomodoro.message = function() { return "test message"};
}
if (Meteor.isClient) {
Meteor.setInterval( timer(), 1000 );
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
それらを同期させるために、すべてのブラウザーに同じタイマー (計算されたサーバー側) をプッシュしたいと考えています。
テンプレートは初回のみ更新されますが、毎秒更新されないのはなぜですか?
ありがとうフランチェスコ