I'm confused. You want your extension to load the module only if the
extension is loaded? If your extension isnt loaded than what is loading
your module.
If you only want to load the module for certain configurations, that sounds
like a job for $wgExtensionFunctions
-bawolff
On 2013-01-27 8:58 PM, "S Page" <spage(a)wikimedia.org> wrote:
How can an extension have a soft requirement on a
module, so that it
only adds that module to its ResourceLoader dependencies if the
extension providing that module is loaded?
For example, there's no sense in depending on ext.eventLog if the wiki
doesn't load Extension:EventLogging, but if it's available then you
want the module sent to the browser along with your code. (Obviously
your JS would check to see if the module's functions are available
before invoking them.)
I think your extension can't change dependencies when specifying its
module in $wgResourceModules[], it has to do it later. Maybe in a
ResourceLoaderRegisterModules hook (although RL runs that before it
registers the static wgResourceModules array), or possibly in a setup
function you add to $wgExtensionFunctions
Or, in each onHook handler where you call addModule(), you could test
there and add the optional module.
Thanks for any insight, I'll add it to
mediawiki.org.
--
=S Page software engineer on Editor Engagement Experiments
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l