Naming the callback is not working
Closed this issue · 1 comments
daroay commented
if I do:
jugChat.subscribe('myChannel', function(data){
alert('success');
});
It works, but if I do:
jugChat.subscribe('myChannel', subscription);
var subscription=function(data){
alert('success');
}
It is not working.
maccman commented
That is because you're not writing valid JavaScript. The subscription variable needs to be assigned before you use it, or you need to use a named function.