I'm digging into jQuery's deferred features. I've tried several examples on the internet. I understood its concept, but I don't understand the difference between resolve()
and promise()
.
What are differences between resolve()
and promise()
?
I'm digging into jQuery's deferred features. I've tried several examples on the internet. I understood its concept, but I don't understand the difference between resolve()
and promise()
.
What are differences between resolve()
and promise()
?
Both
resolve()
andpromise()
are methods on the jQueryDeferred
object.First a snippet from the jQuery documentation about Deferred:
With that in mind,
promise()
returns an object that is very similar to theDeferred
object except that it only hasthen()
,done()
, andfail()
methods and does not haveresolve()
orreject()
.From the blog post m-sharp referred to regarding
promise()
: