Makes the promise method of Deferreds a bit more readable by not using the variable declared as parameter trick anymore.
This commit is contained in:
parent
d5f7711ce0
commit
e405419fb7
1 changed files with 2 additions and 2 deletions
|
@ -890,14 +890,14 @@ jQuery.extend({
|
||||||
isRejected: failDeferred.isResolved,
|
isRejected: failDeferred.isResolved,
|
||||||
// Get a promise for this deferred
|
// Get a promise for this deferred
|
||||||
// If obj is provided, the promise aspect is added to the object
|
// If obj is provided, the promise aspect is added to the object
|
||||||
promise: function( obj , i /* internal */ ) {
|
promise: function( obj ) {
|
||||||
if ( obj == null ) {
|
if ( obj == null ) {
|
||||||
if ( promise ) {
|
if ( promise ) {
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
promise = obj = {};
|
promise = obj = {};
|
||||||
}
|
}
|
||||||
i = promiseMethods.length;
|
var i = promiseMethods.length;
|
||||||
while( i-- ) {
|
while( i-- ) {
|
||||||
obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ];
|
obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue