jQuery promise回调在回调触发错误后停止触发

时间:2015-06-08 16:37:18

标签: javascript jquery

下面给出1-3:

  1. var a = $.Deferred()
  2. a.done(function(){throw Error()});
  3. a.resolve() // Uncaught error
  4. 现在假设调用堆栈被清除。然后我做以下事情:

    1. a.done(function(){console.log('Done')})
    2. a.fail(function(){console.log('Fail')})
    3. a.then(function(){console.log('Then')})
    4. 没有任何反应。为什么?为什么(3)中未被捕获的错误会阻止进一步的回调被解雇?这是设计吗?

0 个答案:

没有答案