https://bugzilla.wikimedia.org/show_bug.cgi?id=23433

--- Comment #2 from Michael Dale <d...@ucsc.edu> 2011-02-21 15:16:15 UTC ---
The way I address this in mwEmbed is through a series of bind and triggers
which give you both temporal loading flexibility and fine grain extendability
of components. 

Bind and triggers are a pefered way for javascript to extend and interact it
offers features like ( name spacing, binding undefined target names, and with
utility functions like triggerQueueCallback, "blocking" triggers. 
http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport/jquery/jquery.triggerQueueCallback.js
 

All the code that is loaded on every page is "loader" code. These loaders
define interface entry points and setup up global bindings. For example see how
timedText extends the embedPlayer interface :

http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.loader.js

and the mwEmbed loader:

http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/EmbedPlayer.loader.js

Hopefully the example is not too specific to the video player context. The
basic point is we should have defined points of extending things so the order
in which things are loaded does not matter as much ( as long as all the "loader
/ binding" code is loaded before the "page ready" or "SetupInterfaces" event is
fired. And all the triggers happen after "page ready"

$(document).ready should NOT mean waiting for a long time. It is fired once the
dom is "ready" not all the images in the page are loaded. A "SetupInterfaces"
and "IntefacesReady" event could also be used but in practice it happens almost
the same time as DOM ready ( since you want to give every loaded javascript a
chance to bind to that event before you trigger it ) ... So if you don't need
more complicated interface state control $(document).ready works just as well.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to