Client code:
var app = {
data: {
user: null
}
};
var client = {
connect: function () {
client.data.socket.on('connectCallback', function (obj) {
if (obj.userFound) {
app.data.user = obj.user;
return app.data.user;
}
});
/**
Other callbacks
**/
};
};
app.data.user
is always null
, I also tried a second function to change the variable. The obj returned by the server isn't null
, I already checked that.
Aucun commentaire:
Enregistrer un commentaire