* @member mw.hook
*/
$( function () {
- var loading = $.grep( mw.loader.getModuleNames(), function ( module ) {
+ var loading, modules;
+
+ modules = $.grep( mw.loader.getModuleNames(), function ( module ) {
return mw.loader.getState( module ) === 'loading';
} );
// 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( loading ).then( null, function () {
- var all = loading.map( function ( module ) {
+ loading = mw.loader.using( modules ).then( null, function () {
+ var all = modules.map( function ( module ) {
return mw.loader.using( module ).then( null, function () {
return $.Deferred().resolve();
} );