mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Renames Deferred's fire and fireReject methods as resolveWith and rejectWith respectively.
This commit is contained in:
parent
ef86694ada
commit
a7cb93bee5
@ -577,9 +577,9 @@ jQuery.extend({
|
|||||||
|
|
||||||
// Success/Error
|
// Success/Error
|
||||||
if ( isSuccess ) {
|
if ( isSuccess ) {
|
||||||
deferred.fire( callbackContext , [ success , statusText , jXHR ] );
|
deferred.resolveWith( callbackContext , [ success , statusText , jXHR ] );
|
||||||
} else {
|
} else {
|
||||||
deferred.fireReject( callbackContext , [ jXHR , statusText , error ] );
|
deferred.rejectWith( callbackContext , [ jXHR , statusText , error ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status-dependent callbacks
|
// Status-dependent callbacks
|
||||||
@ -593,7 +593,7 @@ jQuery.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Complete
|
// Complete
|
||||||
completeDeferred.fire( callbackContext, [ jXHR , statusText ] );
|
completeDeferred.resolveWith( callbackContext, [ jXHR , statusText ] );
|
||||||
|
|
||||||
if ( s.global ) {
|
if ( s.global ) {
|
||||||
globalEventContext.trigger( "ajaxComplete" , [ jXHR , s] );
|
globalEventContext.trigger( "ajaxComplete" , [ jXHR , s] );
|
||||||
|
14
src/core.js
14
src/core.js
@ -406,7 +406,7 @@ jQuery.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there are functions bound, to execute
|
// If there are functions bound, to execute
|
||||||
readyList.fire( document , [ jQuery ] );
|
readyList.resolveWith( document , [ jQuery ] );
|
||||||
|
|
||||||
// Trigger any bound ready events
|
// Trigger any bound ready events
|
||||||
if ( jQuery.fn.trigger ) {
|
if ( jQuery.fn.trigger ) {
|
||||||
@ -844,7 +844,7 @@ jQuery.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( _fired ) {
|
if ( _fired ) {
|
||||||
deferred.fire( _fired[ 0 ] , _fired[ 1 ] );
|
deferred.resolveWith( _fired[ 0 ] , _fired[ 1 ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -852,7 +852,7 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// resolve with given context and args
|
// resolve with given context and args
|
||||||
fire: function( context , args ) {
|
resolveWith: function( context , args ) {
|
||||||
if ( ! cancelled && ! fired && ! firing ) {
|
if ( ! cancelled && ! fired && ! firing ) {
|
||||||
|
|
||||||
firing = 1;
|
firing = 1;
|
||||||
@ -872,7 +872,7 @@ jQuery.extend({
|
|||||||
|
|
||||||
// resolve with this as context and given arguments
|
// resolve with this as context and given arguments
|
||||||
resolve: function() {
|
resolve: function() {
|
||||||
deferred.fire( jQuery.isFunction( this.promise ) ? this.promise() : this , arguments );
|
deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this , arguments );
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -908,7 +908,7 @@ jQuery.extend({
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
fail: failDeferred.done,
|
fail: failDeferred.done,
|
||||||
fireReject: failDeferred.fire,
|
rejectWith: failDeferred.resolveWith,
|
||||||
reject: failDeferred.resolve,
|
reject: failDeferred.resolve,
|
||||||
isRejected: failDeferred.isResolved,
|
isRejected: failDeferred.isResolved,
|
||||||
// Get a promise for this deferred
|
// Get a promise for this deferred
|
||||||
@ -961,10 +961,10 @@ jQuery.extend({
|
|||||||
args = arguments;
|
args = arguments;
|
||||||
resolveArray[ index ] = args.length > 1 ? slice.call( args , 0 ) : value;
|
resolveArray[ index ] = args.length > 1 ? slice.call( args , 0 ) : value;
|
||||||
if( ! --length ) {
|
if( ! --length ) {
|
||||||
deferred.fire( promise, resolveArray );
|
deferred.resolveWith( promise, resolveArray );
|
||||||
}
|
}
|
||||||
}).fail( function() {
|
}).fail( function() {
|
||||||
deferred.fireReject( promise, arguments );
|
deferred.rejectWith( promise, arguments );
|
||||||
});
|
});
|
||||||
return !deferred.isRejected();
|
return !deferred.isRejected();
|
||||||
});
|
});
|
||||||
|
@ -1002,7 +1002,7 @@ test("jQuery._Deferred()", function() {
|
|||||||
|
|
||||||
deferred = jQuery._Deferred();
|
deferred = jQuery._Deferred();
|
||||||
|
|
||||||
deferred.fire( jQuery , [ document ] ).done( function( doc ) {
|
deferred.resolveWith( jQuery , [ document ] ).done( function( doc ) {
|
||||||
ok( this === jQuery && arguments.length === 1 && doc === document , "Test fire context & args" );
|
ok( this === jQuery && arguments.length === 1 && doc === document , "Test fire context & args" );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user