ajax: function ( parameters, ajaxOptions ) {
var token,
apiDeferred = $.Deferred(),
+ msg = 'Use of mediawiki.api callback params is deprecated. Use the Promise instead.',
xhr;
parameters = $.extend( {}, this.defaults.parameters, parameters );
// Backwards compatibility: Before MediaWiki 1.20,
// callbacks were done with the 'ok' and 'err' property in ajaxOptions.
if ( ajaxOptions.ok ) {
+ mw.track( 'mw.deprecate', 'api.cbParam' );
+ mw.log.warn( msg );
apiDeferred.done( ajaxOptions.ok );
delete ajaxOptions.ok;
}
if ( ajaxOptions.err ) {
+ mw.track( 'mw.deprecate', 'api.cbParam' );
+ mw.log.warn( msg );
apiDeferred.fail( ajaxOptions.err );
delete ajaxOptions.err;
}
apiPromise = this.get( {
action: 'tokens',
type: type
- }, {
- // Due to the API assuming we're logged out if we pass the callback-parameter,
- // we have to disable jQuery's callback system, and instead parse JSON string,
- // by setting 'jsonp' to false.
- // TODO: This concern seems genuine but no other module has it. Is it still
- // needed and/or should we pass this by default?
} )
.done( function ( data ) {
// If token type is not available for this user,