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 ) {
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();
}
} );