JQuery deferred reject immediately

前端 未结 2 1403
情深已故
情深已故 2021-01-17 23:10

When using JQuery.Deferred is it OK to invoke reject() directly? Without having invoked a async function?

Perhaps I want some kind of test in the beginning of my asy

2条回答
  •  灰色年华
    2021-01-18 00:08

    You can do it quickly, as your function return a Promise object:

    return Promise.reject('test failed');
    

提交回复
热议问题