}
function defineFallbacks() {
- // <https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Set>
+ // <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set>
StringSet = window.Set || ( function () {
/**
* @private
* OO.compare( [ 1 ], [ 1 ] );
* } );
*
+ * Example of inline dependency obtained via `require()`:
+ *
+ * mw.loader.using( [ 'mediawiki.util' ], function ( require ) {
+ * var util = require( 'mediawiki.util' );
+ * } );
+ *
* Since MediaWiki 1.23 this also returns a promise.
*
* Since MediaWiki 1.28 the promise is resolved with a `require` function.
/**
* Get the exported value of a module.
*
- * Modules may provide this via their local `module.exports`.
+ * This static method is publicly exposed for debugging purposes
+ * only and must not be used in production code. In production code,
+ * please use the dynamically provided `require()` function instead.
*
- * @protected
+ * In case of lazy-loaded modules via mw.loader#using(), the returned
+ * Promise provides the function, see #using() for examples.
+ *
+ * @private
* @since 1.27
* @param {string} moduleName Module name
* @return {Mixed} Exported value
// We only need a callback, not any actual module. First try a single using()
// for all loading modules. If one fails, fall back to tracking each module
// separately via $.when(), this is expensive.
- loading = mw.loader.using( modules ).then( null, function () {
+ loading = mw.loader.using( modules ).catch( function () {
var all = modules.map( function ( module ) {
- return mw.loader.using( module ).then( null, function () {
+ return mw.loader.using( module ).catch( function () {
return $.Deferred().resolve();
} );
} );