クライアントが Meteor メソッド呼び出しから結果を取得した後、js 関数を呼び出す方法を確認しようとしています。myFunc
私が得ることができた唯一のことは、実際のメソッド呼び出しを行ったクライアントでのみ関数を呼び出すことです。現在サブスクライブしているすべてのクライアントで関数を呼び出す方法はありますか?
コードは次のとおりです。
function myFunc(error, result) {
alert(result);
}
if (Meteor.is_client) {
Template.container.events = {
'click input' : function () {
Meteor.call('someMethod',myFunc);
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
};
}
if (Meteor.is_server) {
Meteor.startup(function () {
// code to run on server at startup
});
}
Meteor.methods({
someMethod: function() {
//console.log(!this.is_simulation);
return "something";
}
})
ありがとう