What are deferred and promise object in jQuery?

Technology CommunityCategory: jQueryWhat are deferred and promise object in jQuery?
VietMX Staff asked 3 years ago
  • deferred object is an object than can create a promise and change its state to resolved or rejected. Deferreds are typically used if you write your own function and want to provide a promise to the calling code. You are the producer of the value.
  • promise is, as the name says, a promise about a future value. You can attach callbacks to it to get that value. The promise was “given” to you and you are the receiver of the future value. You cannot modify the state of the promise. Only the code that created the promise can change its state.