客户端代码
Template.hello.events({
"click": function () {
Meteor.call('Message',function(result){
alert(result);
});
服务器端方法调用
if (Meteor.isServer) {
Meteor.methods({
'Message':function(){
SerialPort.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName);
var atxt = port.comName;
return atxt ;
});//ports end
}); //list end
} //message end
}); //method end
} //server end
以上程序' undefined'打印警报框客户端。 return atxt没有返回任何值。请帮我 meteor apllication传递服务器端返回值访问客户端!!!
答案 0 :(得分:1)
当Meteor *this
方法返回一些数据时,客户端需要通过回调获取glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
SDL_GL_SwapWindow(_window);
glPointSize(1);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_UNSIGNED_INT, GL_TRUE, 0, 0);
glDrawArrays(GL_POINTS, 0, _dataCount);
glDisableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
。在该回调中,需要有两个参数server side
。基本上第二个参数是你的结果,第一个参数是asynchronously
(如果有的话)。因此,您需要相应地更新客户端代码。除了从服务器端返回之前,只需error and result
您的数据,这样您就可以确定结果。
error