Sign In Register

How can we help you today?

Start a new topic
Answered

RTSession.setTimeout callback order

Hello


Assume the following code in an RT script. Example simplified to the minimum, left the onPacket in case it somehow matters to the answer.

 

 

function a() { // some code }
function b() { // some code }

RTSession.onPacket(666, function (packet)
{
    RTSession.setTimeout(a, 999);
    RTSession.setTimeout(b, 999);
});

 

 

 

 Question is, given indentical delays, can I safely assume that the callback to functions a and b will be made in the this order, i.e. in the same order RTSession.setTimeout was called?


Regards,

Cristian



Best Answer
Hey Christian,

Yes, i just did a quick test adding logs to both your functions and function A gets called before B in all cases.

Sean

 


Answer
Hey Christian,

Yes, i just did a quick test adding logs to both your functions and function A gets called before B in all cases.

Sean

 

Hello


That I saw too, and seemed most likely. I wanted to be sure that it was guaranteed to be so, since I don't know how the js code runs in your RT stack.

Login to post a comment