From: Michał Gołębiowski-Owczarek Date: Tue, 12 Jan 2021 19:56:51 +0000 (+0100) Subject: Deferred: Rename master to primary X-Git-Tag: 4.0.0-beta~146 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a32cf6324f8f2190e66a687e94be9687ebf840b7;p=jquery.git Deferred: Rename master to primary Closes gh-4828 --- diff --git a/src/deferred.js b/src/deferred.js index d4eaf7a4b..dc4294726 100644 --- a/src/deferred.js +++ b/src/deferred.js @@ -353,8 +353,8 @@ jQuery.extend( { resolveContexts = Array( i ), resolveValues = slice.call( arguments ), - // the master Deferred - master = jQuery.Deferred(), + // the primary Deferred + primary = jQuery.Deferred(), // subordinate callback factory updateFunc = function( i ) { @@ -362,30 +362,30 @@ jQuery.extend( { resolveContexts[ i ] = this; resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); + primary.resolveWith( resolveContexts, resolveValues ); } }; }; // Single- and empty arguments are adopted like Promise.resolve if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, + adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, !remaining ); // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || + if ( primary.state() === "pending" || typeof( resolveValues[ i ] && resolveValues[ i ].then ) === "function" ) { - return master.then(); + return primary.then(); } } // Multiple arguments are aggregated like Promise.all array elements while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); } - return master.promise(); + return primary.promise(); } } );