Is it possible to reset a jQuery deferred object state?

后端 未结 3 1664
终归单人心
终归单人心 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:46

    No. A Promise is by definition a thing that resolves only once - from unresolved to fulfilled OR to rejected. You will not be able to do this with jQuery's Deferreds.

    What you are actually searching for are Signals. They are to be fired more than once, but provide a similiar interface. There are some implementations around, you might ceck out js-signals or wire.js.

提交回复
热议问题