jQuery Deferred's, $.when() and the fail() callback arguments

后端 未结 4 514
灰色年华
灰色年华 2020-12-01 16:08

I\'m getting an unexpected result when using $.when() when one of the deferred operations does not succeed.

Take this JavaScript, which created 2 deferr

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 16:39

    Internally, the "reject" and "fail" paths are handled by two totally separate queues, so it just doesn't work the way you expect.

    In order to know which original Deferred failed from the "when()" group, you could have them pass themselves along with the ".reject()" call as part of an object literal or something.

提交回复
热议问题