/**
* 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.
/**
* 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' );
*
- * @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;
for ( source in id ) {
mw.loader.addSource( source, id[ source ] );
}
- return true;
+ return;
}
if ( hasOwn.call( sources, id ) ) {
throw new Error( 'source already registered: ' + id );
}
- if ( typeof loadUrl === 'object' ) {
- loadUrl = loadUrl.loadScript;
- }
-
sources[ id ] = loadUrl;
-
- return true;
},
/**