r93653 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93652‎ | r93653 | r93654 >
Date:21:01, 1 August 2011
Author:krinkle
Status:ok
Tags:
Comment:
[ResourceLoader2] Create getModuleNames() function
- Returns all keys from the (private) registry object as an array
- Needed for ResourceLoader 2 in order to do autosuggestions for dependancies and cheap non-http-request lookups to avoid duplicate keys when creating new modules/gadgets.

(bug 30160 ) Add public method to mw.loader to get module names from registry
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -1156,6 +1156,18 @@
11571157 return null;
11581158 };
11591159
 1160+ /**
 1161+ * Get names of all registered modules.
 1162+ *
 1163+ * @return {Array}
 1164+ */
 1165+ this.getModuleNames = function() {
 1166+ var names = $.map( registry, function( i, key ) {
 1167+ return key;
 1168+ } );
 1169+ return names;
 1170+ };
 1171+
11601172 /* Cache document ready status */
11611173
11621174 $(document).ready( function() { ready = true; } );
Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -22,6 +22,7 @@
2323 * (bug 30022) Add support for custom loadScript sources to ResourceLoader.
2424 * (bug 19052) Unicode space separator characters (Zs) now terminates external
2525 links and images links.
 26+* (bug 30160) Add public method to mw.loader to get module names from registry.
2627
2728 === Bug fixes in 1.19 ===
2829 * $wgUploadNavigationUrl should be used for file redlinks if

Status & tagging log