Follows-up
e103ba265b.
This method doesn't need to be backward-compatible as this is already
normalised server-side.
When upgrading from before MediaWiki 1.24 the startup response will
change to the new format and also inline a request to the newer
version of mediawiki.js.
Also update method documentation to be up to date and remove
spurious return statements that aren't used.
Change-Id: I03d1b5666fcddedaa46ecf878ee7636042a5e3be
/**
* Add a foreign source of modules.
*
/**
* Add a foreign source of modules.
*
+ * Source IDs are typically the same as the Wiki ID or database name (e.g. lowercase a-z).
+ *
* @param array|string $id Source ID (string), or array( id1 => loadUrl, id2 => loadUrl, ... )
* @param string|array $loadUrl load.php url (string), or array with loadUrl key for
* backwards-compatibility.
* @param array|string $id Source ID (string), or array( id1 => loadUrl, id2 => loadUrl, ... )
* @param string|array $loadUrl load.php url (string), or array with loadUrl key for
* backwards-compatibility.
/**
* Register a source.
*
/**
* Register a source.
*
- * The #work method will use this information to split up requests by source.
+ * The #work() method will use this information to split up requests by source.
*
* mw.loader.addSource( 'mediawikiwiki', '//www.mediawiki.org/w/load.php' );
*
*
* mw.loader.addSource( 'mediawikiwiki', '//www.mediawiki.org/w/load.php' );
*
- * @param {string} id Short string representing a source wiki, used internally for
- * registered modules to indicate where they should be loaded from (usually lowercase a-z).
- * @param {Object|string} loadUrl load.php url, may be an object for backwards-compatibility
- * @return {boolean}
+ * @param {string|Object} id Source ID, or object mapping ids to load urls
+ * @param {string} loadUrl Url to a load.php end point
+ * @throws {Error} If source id is already registered
*/
addSource: function ( id, loadUrl ) {
var source;
*/
addSource: function ( id, loadUrl ) {
var source;
for ( source in id ) {
mw.loader.addSource( source, id[ source ] );
}
for ( source in id ) {
mw.loader.addSource( source, id[ source ] );
}
}
if ( hasOwn.call( sources, id ) ) {
throw new Error( 'source already registered: ' + id );
}
}
if ( hasOwn.call( sources, id ) ) {
throw new Error( 'source already registered: ' + id );
}
- if ( typeof loadUrl === 'object' ) {
- loadUrl = loadUrl.loadScript;
- }
-