*/
( function ( mw, $ ) {
+ var msg = 'Use of mediawiki.api callback params is deprecated. Use the Promise instead.';
$.extend( mw.Api.prototype, {
/**
* Determine if a category exists.
apiPromise;
// Backwards compatibility (< MW 1.20)
- d.done( ok ).fail( err );
+ if ( ok || err ) {
+ mw.track( 'mw.deprecate', 'api.cbParam' );
+ mw.log.warn( msg );
+ d.done( ok ).fail( err );
+ }
apiPromise = this.get( {
prop: 'categoryinfo',
} );
}
d.resolve( exists );
- })
+ } )
.fail( d.reject );
return d.promise( { abort: apiPromise.abort } );
apiPromise;
// Backwards compatibility (< MW 1.20)
- d.done( ok ).fail( err );
+ if ( ok || err ) {
+ mw.track( 'mw.deprecate', 'api.cbParam' );
+ mw.log.warn( msg );
+ d.done( ok ).fail( err );
+ }
// Fetch with allpages to only get categories that have a corresponding description page.
apiPromise = this.get( {
list: 'allpages',
apprefix: prefix,
- apnamespace: mw.config.get('wgNamespaceIds').category
+ apnamespace: mw.config.get( 'wgNamespaceIds' ).category
} )
.done( function ( data ) {
var texts = [];
} );
}
d.resolve( texts );
- })
+ } )
.fail( d.reject );
return d.promise( { abort: apiPromise.abort } );
apiPromise;
// Backwards compatibility (< MW 1.20)
- d.done( ok ).fail( err );
+ if ( ok || err ) {
+ mw.track( 'mw.deprecate', 'api.cbParam' );
+ mw.log.warn( msg );
+ d.done( ok ).fail( err );
+ }
apiPromise = this.get( {
prop: 'categories',