<p>One model for understanding Deferred is to think of it as a chain-aware function wrapper. The <a href="/deferred.then/"><code>deferred.then()</code></a>, <a href="/deferred.always/"><code>deferred.always()</code></a>, <a href="/deferred.done/"><code>deferred.done()</code></a>, and <a href="/deferred.fail/"><code>deferred.fail()</code></a> methods specify the functions to be called and the <a href="/deferred.resolve/"><code>deferred.resolve(args)</code></a> or <a href="/deferred.reject/"><code>deferred.reject(args)</code></a> methods "call" the functions with the arguments you supply. Once the Deferred has been resolved or rejected it stays in that state; a second call to <code>deferred.resolve()</code>, for example, is ignored. If more functions are added by <code>deferred.then()</code>, for example, after the Deferred is resolved, they are called immediately with the arguments previously provided.</p>
0 commit comments