Monday, 22 May 2017

Two separated events in node.js

I have two different events. One is :

 io.on('connection', function(socket) {
    var arg1;
    var arg2;
    var arg3;
    Game.add({arg1,arg2,arg3)}; // here i must create object because here i have avaible arg1,arg2,arg3, but I want do this when other events have somethink to do.

}

here is other events:

bot.game.on('newPlayer', _onChanged.bind(bot));

and when this events call I want to execute Game.add in other events. Is any possible to do this?



via Jensej

No comments:

Post a Comment