Skip to content

Document jQuery.ready as Promise-consumable #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions entries/jQuery.holdReady.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ $.getScript( "myplugin.js", function() {
]]></code>
</example>
<category slug="core"/>
<category slug="properties/global-jquery-object-properties"/>
<category slug="events/document-loading"/>
<category slug="version/1.6"/>
</entry>
38 changes: 38 additions & 0 deletions entries/jQuery.ready.promise.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<entry type="method" name="jQuery.ready.promise" return="Promise">
<title>jQuery.ready.promise()</title>
<desc>Return a Promise that is resolved when the document is ready.</desc>
<signature>
<added>1.8</added>
<argument name="target" type="Object" optional="true">
<desc>Object onto which the promise methods have to be attached</desc>
</argument>
</signature>
<longdesc>
<p>See also <code><a href="/ready/">ready()</a></code>, which makes use of this.</p>
</longdesc>
<example>
<desc>Listen for document ready using a Promise object.</desc>
<code><![CDATA[
$.ready.promise().done(function() {
// Document is ready.
});
]]></code>
</example>
<example>
<desc>Listen for document ready via <code><a href="/jQuery.when/">jQuery.when</a>.</desc>
<code><![CDATA[
$.when(
$.getJSON( "ajax/test.json" ),
$.ready
).done(function( data ) {
// Document is ready.
// Value of test.json is passed as `data`.
});
]]></code>
</example>
<category slug="core"/>
<category slug="properties/global-jquery-object-properties"/>
<category slug="events/document-loading"/>
<category slug="version/1.8"/>
</entry>