jQuery uses the XMLHttpRequest object.(jQuery使用XMLHttpRequest对象。)
It has a synchronous mode built-in (which is handled in native code).(它具有内置的同步模式(以本机代码处理)。)
As you noticed, it blocks all other code execution.(如您所见,它阻止了所有其他代码的执行。)
As a result of this that feature is deprecated and should not be used.(因此,该功能已被弃用 ,不应使用。)
Note that this isn't converting asynchronous code to synchronous code, there is no technique which can do that in the general case (although await
can give the illusion of synchronous code within promise).(请注意,这并不是将异步代码转换为同步代码,在一般情况下,没有任何一种技术可以做到这一点(尽管await
可以使承诺中的同步代码产生错觉)。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…