ResourceLoader: expose registry as mediaWiki.loader.moduleRegistry
authorOri Livneh <ori@wikimedia.org>
Wed, 25 Sep 2013 16:06:41 +0000 (09:06 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 25 Sep 2013 17:52:45 +0000 (19:52 +0200)
This patch exports the ResourceLoader registry object as a public member of
mw.loader. I understand that it is not properly a part of the public API
ResourceLoader exposes to JavaScript code; it is an internal data structure and
ResourceLoader does not expect to have anything modify it except ResourceLoader
itself. At the same time, it provides a trove of extremely valuable data for
debugging and profiling, and it's annoying as hell not to be able to poke and
prod it from the JS console. So my hope is that we do the Python thing of
treating 'private' as a tip and social convention rather than something that is
enforced by the code.

Change-Id: I1c47970aa9fceb0b2ded9008efc926b46fa08f51

resources/mediawiki/mediawiki.js

index 741e231..d1a541e 100644 (file)
@@ -1205,6 +1205,16 @@ var mw = ( function ( $, undefined ) {
 
                        /* Public Methods */
                        return {
+                               /**
+                                * The module registry is exposed as an aid for debugging and inspecting page
+                                * state; it is not a public interface for modifying the registry.
+                                *
+                                * @see #registry
+                                * @property
+                                * @private
+                                */
+                               moduleRegistry: registry,
+
                                /**
                                 * @inheritdoc #newStyleTag
                                 * @method