]> source.dussan.org Git - jquery.git/commitdiff
Deferred: Rename master to primary
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Tue, 12 Jan 2021 19:56:51 +0000 (20:56 +0100)
committerGitHub <noreply@github.com>
Tue, 12 Jan 2021 19:56:51 +0000 (20:56 +0100)
Closes gh-4828

src/deferred.js

index d4eaf7a4bcf412b117f5218ddfa0472d44103fe2..dc42947265dd75b6c69f2224c6d602ad792434e5 100644 (file)
@@ -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();
        }
 } );