S
S
Sergey2017-04-17 17:20:15
Node.js
Sergey, 2017-04-17 17:20:15

How to organize a node js function execution queue?

Good afternoon. Faced a small problem with a problem. How to arrange a very fulfilling function. Now done like this

var starter_game = true;//пермит старта игры
    function start_game(game, time){
    if(starter_game = true){//проверка на то стартанут ли таймер
      starter_game = false;//лочим

      console.log('Работаем!');
        //тут рабочий код

    }
  }

There is such a moment that a function can be requested 2 times, and the current implementation cannot cope with blocking the second request. How can this be fixed?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2017-04-17
@interests70

var starter_game = true; // пермит старта игры
function start_game(game, time){
    //if(starter_game = true) { // проверка на то стартанут ли таймер (уверены?)
    if(starter_game === true) { // А вот проверка на то стартанут ли таймер
      starter_game = false; // лочим
      console.log('Работаем!');

    }
}

V
Vitaly, 2017-04-17
@vshvydky

Well, this question is more like nonsense ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question