Skip to content

Commit 26006aa

Browse files
evverxarthurvr
authored andcommitted
jQuery.when: remove unnecessary new operator
This is more consistent with other entries. Closes gh-683
1 parent a911025 commit 26006aa

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

entries/deferred.promise.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<desc>Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first "wins" and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds "working..." to the document body.</desc>
1919
<code><![CDATA[
2020
function asyncEvent() {
21-
var dfd = new jQuery.Deferred();
21+
var dfd = jQuery.Deferred();
2222
2323
// Resolve after a random interval
2424
setTimeout(function() {

entries/jQuery.when.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ $.when( { testing: 123 } ).done(function( x ) {
2323
</code></pre>
2424
<p>In the case where multiple Deferred objects are passed to <code>jQuery.when()</code>, the method returns the Promise from a new "master" Deferred object that tracks the aggregate state of all the Deferreds it has been passed. The method will resolve its master Deferred as soon as all the Deferreds resolve, or reject the master Deferred as soon as one of the Deferreds is rejected. If the master Deferred is resolved, the doneCallbacks for the master Deferred are executed. The arguments passed to the doneCallbacks provide the resolved values for each of the Deferreds, and matches the order the Deferreds were passed to <code>jQuery.when()</code>. For example:</p>
2525
<pre><code>
26-
var d1 = new $.Deferred();
27-
var d2 = new $.Deferred();
26+
var d1 = $.Deferred();
27+
var d2 = $.Deferred();
2828

2929
$.when( d1, d2 ).done(function ( v1, v2 ) {
3030
console.log( v1 ); // "Fish"
@@ -36,9 +36,9 @@ d2.resolve( "Pizza" );
3636
</code></pre>
3737
<p>In the event a Deferred was resolved with no value, the corresponding doneCallback argument will be undefined. If a Deferred resolved to a single value, the corresponding argument will hold that value. In the case where a Deferred resolved to multiple values, the corresponding argument will be an array of those values. For example:</p>
3838
<pre><code>
39-
var d1 = new $.Deferred();
40-
var d2 = new $.Deferred();
41-
var d3 = new $.Deferred();
39+
var d1 = $.Deferred();
40+
var d2 = $.Deferred();
41+
var d3 = $.Deferred();
4242

4343
$.when( d1, d2, d3 ).done(function ( v1, v2, v3 ) {
4444
console.log( v1 ); // v1 is undefined

0 commit comments

Comments
 (0)