User-1537395504 posted
Hello,
Please can you advise on best way to pass my response from a signalR hub to a function call which had a call back .. I've tried a global variable to stor the call back and call that on receive data but no luck. heres what i like to do;
school.lib.setmytime = function(_time){
console.log('mytime is :' + _time);
}
school.lib.gettime = data.getservertime(school.lib.setmytime);
-----------------
var myhub;
data.connection = function(){
$connection.hub.url = 'http://myserver.com:65442';
$connection.hub.start();
myhub = $.connection.adminHub;
myhub.client.getServerTime = function (_time){
//How do i access the callback
//function in data.getservertime so as to return time to the school.lib.gettime?
}
}
data.getservertime = function(callbak){
myhub.server.getServerTime();
}