On 01/31/2013 03:08 AM, Robert Vogel wrote:
Hi Daniel,
I'm not very experienced with ResourceLoader, but maybe 'mw.loader.using()' [1] suits your needs. You can specify a module dependency and a callback function on the client side.
using is the right solution for server scripts, or potentially for as-needed dependencies (only load if the user does XYZ). However, if the server code (core or extension) knows a module will be needed, it should use OutputPage::addModules or similar to avoid unnecessary round-drips.
Another way to keep the right execution order may be to establish some kind of "global hook system" within your own extensions. Let's say Extension2 depends on javascript code executed by Extension1. Then trigger [2] an event using jquery
This is only potentially needed if there's something unusual/non-blocking about the load, such as setTimeout (see my previous email). Otherwise, ResourceLoader dependencies (and maybe object-oriented programming to help structure) should work.
Matt Flaschen