A
A
Alexander Kurakin2016-01-18 22:59:26
JavaScript
Alexander Kurakin, 2016-01-18 22:59:26

How to test concurrent function call in JavaScript?

There is a function:

var inRendering = false;
function render() {
  if (inRendering) {
    requestAnimationFrame(render);
  } else {
    inRendering = true;
    requestAnimationFrame(function () {
      longAction();
      inRendering = false;
    });
  }
}

For it, you need to write a unit test (the case of a concurrent call render).
Help me please? Is such a concurrent call possible in JavaScript? Thank you.
PS I made an attempt. Reason for failure - see comment: https://gist.github.com/kuraga/b0aa3d66fc0620f03b11

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question