Onreadystatechange callback behaviour for XMLHttpRequest
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?
开发者_JAVA百科Best Regards, Keshav
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.
精彩评论