Pergunta

If XMLHttpRequest is used with asynchronous mode, then are the onreadystatechange callbacks for 0,1,2 states called in UI thread only or in the background thread?

And is it possible that this behaviour could be different in different browsers?

Best Regards, Keshav

Foi útil?

Solução

Unless you're specifically using background workers (which are browser extensions and not universally implemented yet; i.e. you'd know if you were using them), everything will always run in the same thread. That's how JavaScript works.

Of course, some implementations might optimize things by running JS in a separate thread, but this will always be invisible to you.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top