From a133085828d78ea716bcd19aa792e2e8fb7a0e32 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 28 Jan 2016 23:23:36 +0100 Subject: [PATCH] mw.loader: Minor documentation and test improvements Update outdated mw.loader.implement documentation * Not all arguments are required. * Even 'script' is no longer required. Defaults to 'null' in the registry. And supported by execute(). * Add a test for implement() with a name only and no resources. Bug: T112455 Change-Id: I5ebd8542ae1a4b2f14ffaff560b98b4c1c2adb23 --- resources/src/mediawiki/mediawiki.js | 24 +++++++++---------- .../resources/mediawiki/mediawiki.test.js | 5 ++++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index b04e01c2a2..b8349d0f91 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -554,7 +554,7 @@ /** * Get a message object. * - * Shorcut for `new mw.Message( mw.messages, key, parameters )`. + * Shortcut for `new mw.Message( mw.messages, key, parameters )`. * * @see mw.Message * @param {string} key Key of message to get @@ -597,7 +597,7 @@ */ /** - * Write a message the console's warning channel. + * Write a message to the console's warning channel. * Actions not supported by the browser console are silently ignored. * * @param {...string} msg Messages to output to console @@ -607,7 +607,7 @@ $.noop; /** - * Write a message the console's error channel. + * Write a message to the console's error channel. * * Most browsers provide a stacktrace by default if the argument * is a caught Error object. @@ -1004,7 +1004,7 @@ /** * A module has entered state 'ready', 'error', or 'missing'. Automatically update * pending jobs and modules that depend upon this module. If the given module failed, - * propagate the 'error' state up the dependency tree. Otherwise, go ahead an execute + * propagate the 'error' state up the dependency tree. Otherwise, go ahead and execute * all jobs/modules now having their dependencies satisfied. * * Jobs that depend on a failed module, will have their error callback ran (if any). @@ -1252,7 +1252,7 @@ script( $, $ ); markModuleReady(); } else if ( typeof script === 'string' ) { - // Site and user modules are a legacy scripts that run in the global scope. + // Site and user modules are legacy scripts that run in the global scope. // This is transported as a string instead of a function to avoid needing // to use string manipulation to undo the function wrapper. if ( module === 'user' ) { @@ -1372,7 +1372,7 @@ } /** - * Adds a dependencies to the queue with optional callbacks to be run + * Adds all dependencies to the queue with optional callbacks to be run * when the dependencies are ready or fail * * @private @@ -1765,10 +1765,8 @@ * When #load or #using requests one or more modules, the server * response contain calls to this function. * - * All arguments are required. - * * @param {string} module Name of module - * @param {Function|Array} script Function with module code or Array of URLs to + * @param {Function|Array} [script] Function with module code or Array of URLs to * be used as the src attribute of a new `