Skip to content

Commit cc4cc30

Browse files
ChadKillingswortharthurvr
authored andcommitted
deferred.promise: promise objects also have the .promise() method
Closes jquerygh-753
1 parent 2519ef6 commit cc4cc30

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

entries/deferred.promise.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</signature>
1010
<desc> Return a Deferred's Promise object. </desc>
1111
<longdesc>
12-
<p>The <code>deferred.promise()</code> method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request. The Promise exposes only the Deferred methods needed to attach additional handlers or determine the state (<code>then</code>, <code>done</code>, <code>fail</code>, <code>always</code>, <code>pipe</code>, <code>progress</code>, and <code>state</code>), but not ones that change the state (<code>resolve</code>, <code>reject</code>, <code>notify</code>, <code>resolveWith</code>, <code>rejectWith</code>, and <code>notifyWith</code>).</p>
12+
<p>The <code>deferred.promise()</code> method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request. The Promise exposes only the Deferred methods needed to attach additional handlers or determine the state (<code>then</code>, <code>done</code>, <code>fail</code>, <code>always</code>, <code>pipe</code>, <code>progress</code>, <code>state</code> and <code>promise</code>), but not ones that change the state (<code>resolve</code>, <code>reject</code>, <code>notify</code>, <code>resolveWith</code>, <code>rejectWith</code>, and <code>notifyWith</code>).</p>
1313
<p>If <code>target</code> is provided, <code>deferred.promise()</code> will attach the methods onto it and then return this object rather than create a new one. This can be useful to attach the Promise behavior to an object that already exists.</p>
1414
<p>If you are creating a Deferred, keep a reference to the Deferred so that it can be resolved or rejected at some point. Return <em>only</em> the Promise object via <code>deferred.promise()</code> so other code can register callbacks or inspect the current state.</p>
1515
<p>For more information, see the documentation for <a href="/category/deferred-object/">Deferred object</a>.</p>

pages/Types.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ <h2 id="Deferred"> Deferred Object</h2>
638638
<p>As of jQuery 1.5, the <a href="/category/deferred-object/">Deferred</a> object provides a way to register multiple callbacks into self-managed callback queues, invoke callback queues as appropriate, and relay the success or failure state of any synchronous or asynchronous function.
639639
</p>
640640
<h2 id="Promise"> Promise Object</h2>
641-
<p>This object provides a subset of the methods of the <a href="/category/deferred-object/">Deferred</a> object (<a href="/deferred.then/"><code>then</code></a>, <a href="/deferred.done/"><code>done</code></a>, <a href="/deferred.fail/"><code>fail</code></a>, <a href="/deferred.always/"><code>always</code></a>, <a href="/deferred.pipe/"><code>pipe</code></a>, <a href="/deferred.progress/"><code>progress</code></a>, and <a href="/deferred.state/"><code>state</code></a>) to prevent users from changing the state of the Deferred.
641+
<p>This object provides a subset of the methods of the <a href="/category/deferred-object/">Deferred</a> object (<a href="/deferred.then/"><code>then</code></a>, <a href="/deferred.done/"><code>done</code></a>, <a href="/deferred.fail/"><code>fail</code></a>, <a href="/deferred.always/"><code>always</code></a>, <a href="/deferred.pipe/"><code>pipe</code></a>, <a href="/deferred.progress/"><code>progress</code></a>, <a href="/deferred.state/"><code>state</code></a> and <a href="/deferred.promise/"><code>promise</code></a>) to prevent users from changing the state of the Deferred.
642642
</p>
643643
<h2 id="Callbacks">Callbacks Object</h2>
644644
<p>A multi-purpose object that provides a powerful way to manage callback lists. It supports adding, removing, firing, and disabling callbacks. The Callbacks object is created and returned by the <code>$.Callbacks</code> function and subsequently returned by most of that function's methods. </p>

0 commit comments

Comments
 (0)