From: Krinkle Date: Mon, 1 Aug 2011 21:01:32 +0000 (+0000) Subject: [ResourceLoader2] Create getModuleNames() function X-Git-Tag: 1.31.0-rc.0~28513 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=02fee5f4047f8ce751ca9687b8084e1ccc29676f;p=lhc%2Fweb%2Fwiklou.git [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 --- diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 818d98223a..4d2e622768 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -22,6 +22,7 @@ production. * (bug 30022) Add support for custom loadScript sources to ResourceLoader. * (bug 19052) Unicode space separator characters (Zs) now terminates external links and images links. +* (bug 30160) Add public method to mw.loader to get module names from registry. === Bug fixes in 1.19 === * $wgUploadNavigationUrl should be used for file redlinks if diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index 9cf0bf10c5..fd5d79ec4f 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -1156,6 +1156,18 @@ window.mw = window.mediaWiki = new ( function( $ ) { return null; }; + /** + * Get names of all registered modules. + * + * @return {Array} + */ + this.getModuleNames = function() { + var names = $.map( registry, function( i, key ) { + return key; + } ); + return names; + }; + /* Cache document ready status */ $(document).ready( function() { ready = true; } );