web-wiki/resources/mediawiki/mediawiki.js
/**
			 * Executes a loaded module, making it ready to use
			 *
			 * @param module string module name to execute
			 */
Executes a loaded module, making it ready to use

@param module string module name to execute
Executes a loaded module making it ready to use @param module string module name to execute
function execute( module, callback ) {
				var style, media, i, script, markModuleReady, nestedAddScript;
				if ( registry[module] === undefined ) {
					throw new Error( 'Module has not been registered yet: ' + module );
				} else if ( registry[module].state === 'registered' ) {
					throw new Error( 'Module has not been requested from the server yet: ' + module );
				} else if ( registry[module].state === 'loading' ) {
					throw new Error( 'Module has not completed loading yet: ' + module );
				} else if ( registry[module].state === 'ready' ) {
					throw new Error( 'Module has already been loaded: ' + module );
				}
				if ( $.isPlainObject( registry[module].style ) ) {
					for ( media in registry[module].style ) {
						style = registry[module].style[media];
						if ( $.isArray( style ) ) {
							for ( i = 0; i < style.length; i += 1 ) {
								getMarker().before( mw.html.element( 'link', {
									'type': 'text/css',
									'media': media,
									'rel': 'stylesheet',
									'href': style[i]
								} ) );
							}
						} else if ( typeof style === 'string' ) {
							addInlineCSS( style, media );
						}
					}
				}
				if ( $.isPlainObject( registry[module].messages ) ) {
					mw.messages.set( registry[module].messages );
				}
				try {
					script = registry[module].script;
					markModuleReady = function() {
						registry[module].state = 'ready';
						handlePending( module );
						if ( $.isFunction( callback ) ) {
							callback();
						}
					};
					nestedAddScript = function ( arr, callback, async, i ) {
						if ( i >= arr.length ) {
							callback();
							return;
						}
						addScript( arr[i], function() {
							nestedAddScript( arr, callback, async, i + 1 );
						}, async );
					};
					if ( $.isArray( script ) ) {
						registry[module].state = 'loading';
						nestedAddScript( script, markModuleReady, registry[module].async, 0 );
					} else if ( $.isFunction( script ) ) {
						script( $ );
						markModuleReady();
					}
				} catch ( e ) {
					if ( window.console && typeof window.console.log === 'function' ) {
						console.log( 'mw.loader::execute> Exception thrown by ' + module + ': ' + e.message );
					}
					registry[module].state = 'error';
				}
			}
function execute ( module , callback ) { var style , media , i , script , markModuleReady , nestedAddScript ; if ( registry [ module ] === undefined ) { throw new Error ( 'Module has not been registered yet: ' + module ) ; } else if ( registry [ module ] . state === 'registered' ) { throw new Error ( 'Module has not been requested from the server yet: ' + module ) ; } else if ( registry [ module ] . state === 'loading' ) { throw new Error ( 'Module has not completed loading yet: ' + module ) ; } else if ( registry [ module ] . state === 'ready' ) { throw new Error ( 'Module has already been loaded: ' + module ) ; } if ( $ . isPlainObject ( registry [ module ] . style ) ) { for ( media in registry [ module ] . style ) { style = registry [ module ] . style [ media ] ; if ( $ . isArray ( style ) ) { for ( i = 0 ; i < style . length ; i += 1 ) { getMarker ( ) . before ( mw . html . element ( 'link' , { 'type' : 'text/css' , 'media' : media , 'rel' : 'stylesheet' , 'href' : style [ i ] } ) ) ; } } else if ( typeof style === 'string' ) { addInlineCSS ( style , media ) ; } } } if ( $ . isPlainObject ( registry [ module ] . messages ) ) { mw . messages . set ( registry [ module ] . messages ) ; } try { script = registry [ module ] . script ; markModuleReady = function ( ) { registry [ module ] . state = 'ready' ; handlePending ( module ) ; if ( $ . isFunction ( callback ) ) { callback ( ) ; } } ; nestedAddScript = function ( arr , callback , async , i ) { if ( i >= arr . length ) { callback ( ) ; return ; } addScript ( arr [ i ] , function ( ) { nestedAddScript ( arr , callback , async , i + 1 ) ; } , async ) ; } ; if ( $ . isArray ( script ) ) { registry [ module ] . state = 'loading' ; nestedAddScript ( script , markModuleReady , registry [ module ] . async , 0 ) ; } else if ( $ . isFunction ( script ) ) { script ( $ ) ; markModuleReady ( ) ; } } catch ( e ) { if ( window . console && typeof window . console . log === 'function' ) { console . log ( 'mw.loader::execute> Exception thrown by ' + module + ': ' + e . message ) ; } registry [ module ] . state = 'error' ; } }
Executes a loaded module, making it ready to use
Executes a loaded module making it ready to use
// Add styles
 // Add localizations to message system
 // Execute script
 // Recursively call addScript() in its own callback
 // for each element of arr.
 // We're at the end of the array
 // This needs to NOT use mw.log because these errors are common in production mode
 // and not in debug mode, such as when a symbol that should be global isn't exported
