Regarding #2, I highly recommend reading Trevor Burnham's excellent book Async JavaScript. It goes into a great deal of detail explaining how async operations work, and ways of dealing with them.
…arbitrary groupings of those ajax calls (callback1 runs when ajax1 and ajax2 are done, but callback2 runs when ajax1 and ajax3 are done). I first learned about promises in Trevor Burnham's excellent book Async Javascript (http://pragprog.com/book/tbajs/async-javascript) and it is still the best explanation of promises I've ever read. If you like this article and are interested in reading further about promises or the…
关于第 2 点,我强烈推荐读一读 Trevor Burnham 那本写得极好的书《Async JavaScript》。它非常详尽地解释了 async 操作的底层机制以及应对它们的方法。
Regarding #2, I highly recommend reading Trevor Burnham's excellent book Async JavaScript. It goes into a great deal of detail explaining how async operations work, and ways of dealing with them.
……那些 ajax 调用的任意组合(比如 callback1 在 ajax1 和 ajax2 完成时运行,但 callback2 在 ajax1 和 ajax3 完成时运行)。我最早是在 Trevor Burnham 写的那本神书《Async Javascript》(http://pragprog.com/book/tbajs/async-javascript)里了解到 promise 的,它至今仍是我读过的对 promise 最棒的解释。如果你喜欢这篇文章,并有兴趣进一步了解 promise 或者……
…arbitrary groupings of those ajax calls (callback1 runs when ajax1 and ajax2 are done, but callback2 runs when ajax1 and ajax3 are done). I first learned about promises in Trevor Burnham's excellent book Async Javascript (http://pragprog.com/book/tbajs/async-javascript) and it is still the best explanation of promises I've ever read. If you like this article and are interested in reading further about promises or the…