Is it possible to reset a jQuery deferred object state?

后端 未结 3 1665
终归单人心
终归单人心 2021-01-11 09:39

Is it possible to reset a resolved jQuery object to an \'unresolved\' state and kick off it\'s initialization and callbacks all over again?

The specific thing I\'m d

3条回答
  •  暖寄归人
    2021-01-11 09:47

    The only solution I could find is to reset the $.Deferred object and return new Promise from that one. It works together with some internal API dirty checking (if something gets edited / deleted), but would be more performant to just reset the existing $.Deferred and let it re-resolve on the next Promise request.

提交回复
热议问题