jQuery's ajax method provides a better way to load a javascript, and it can detect when the script would be loaded and excute the callback function. I think we can implement it to our mw.loader.load. jQuery.ajax provides two way (ajax or inject) to load a javascript, you should set cache=true to use the inject one.
Philip Tzou
2011/2/18 Philip Tzou philip.npc@gmail.com:
jQuery's ajax method provides a better way to load a javascript, and it can detect when the script would be loaded and excute the callback function. I think we can implement it to our mw.loader.load. jQuery.ajax provides two way (ajax or inject) to load a javascript, you should set cache=true to use the inject one.
I guess we could use this when loading stuff from arbitrary URLs in the future, but for normal module loads the mediaWiki.loader.implement() call in the server output works fine.
Roan Kattouw (Catrope)
On 02/18/2011 01:01 PM, Roan Kattouw wrote:
2011/2/18 Philip Tzou philip.npc@gmail.com:
jQuery's ajax method provides a better way to load a javascript, and it can detect when the script would be loaded and excute the callback function. I think we can implement it to our mw.loader.load. jQuery.ajax provides two way (ajax or inject) to load a javascript, you should set cache=true to use the inject one.
I guess we could use this when loading stuff from arbitrary URLs in the future, but for normal module loads the mediaWiki.loader.implement() call in the server output works fine.
Client side there is the mediaWiki.loader.using call which allows you to supply a callback, unfortunately there are some bugs in debug mode output and implement gets called before the scripts are actually ready, but it should work for production mode.
--michael
2011/2/19 Michael Dale mdale@wikimedia.org
On 02/18/2011 01:01 PM, Roan Kattouw wrote:
2011/2/18 Philip Tzou philip.npc@gmail.com:
jQuery's ajax method provides a better way to load a javascript, and it
can
detect when the script would be loaded and excute the callback function.
I
think we can implement it to our mw.loader.load. jQuery.ajax provides
two
way (ajax or inject) to load a javascript, you should set cache=true to
use
the inject one.
I guess we could use this when loading stuff from arbitrary URLs in the future, but for normal module loads the mediaWiki.loader.implement() call in the server output works fine.
Client side there is the mediaWiki.loader.using call which allows you to supply a callback, unfortunately there are some bugs in debug mode output and implement gets called before the scripts are actually ready, but it should work for production mode.
--michael
What about user-created scripts? mediaWiki.loader.using can only implement MediaWiki built-in scripts which has been registered to RL.
2011/2/19 Philip Tzou philip.npc@gmail.com:
What about user-created scripts? mediaWiki.loader.using can only implement MediaWiki built-in scripts which has been registered to RL.
That's part of what I meant by "arbitrary URLs" below:
I guess we could use this when loading stuff from arbitrary URLs in the future, but for normal module loads the mediaWiki.loader.implement() call in the server output works fine.
There is a bug open about allowing loading wiki pages through RL: https://bugzilla.wikimedia.org/show_bug.cgi?id=25845
Roan Kattouw (Catrope)
2011/2/19 Roan Kattouw roan.kattouw@gmail.com
2011/2/19 Philip Tzou philip.npc@gmail.com:
What about user-created scripts? mediaWiki.loader.using can only
implement
MediaWiki built-in scripts which has been registered to RL.
That's part of what I meant by "arbitrary URLs" below:
I guess we could use this when loading stuff from arbitrary URLs in the future, but for normal module loads the mediaWiki.loader.implement() call in the server output works fine.
There is a bug open about allowing loading wiki pages through RL: https://bugzilla.wikimedia.org/show_bug.cgi?id=25845
Roan Kattouw (Catrope)
hmm, I replied that message to Michael.
Philip Tzou
wikitech-l@lists.wikimedia.org