Excellent point, thanks for sharing!

On Thu, Jun 29, 2017 at 4:50 PM, Krinkle <[email protected]> wrote:

> You might prefer the using the $.when() idiom for this, which waits for
> multiple concurrent promises, and is usable here given that $() is
> essentially a shortcut to the internal $.ready promise, which is publicly
> available per https://api.jquery.com/jQuery.ready/ – The following has
> worked for years (since jQuery 1.8), and became documented (and officially
> supported) since jQuery 3.
>
> $.when(
>   $.ready,
>   mw.loader.using( [ 'mediawiki.util' ] )
> ).then(function(){
>   // mw.util.addPortletLink( ... );
> } );
>
>
> On Sun, May 21, 2017 at 4:31 PM, Brion Vibber wrote:
>
> > If you both need to manipulate part of the page and need a specific
> module,
> > probably this:
> >
> > // If we haven't already started loading the module, start loading it:
> > mw.loader.using('mediawiki.util', function() {
> >   // Module is loaded, *but* it's possible the page HTML is not done.
> Wait
> >   // for it:
> >   $( function() {
> >     // Now it should be safe to do everything:
> >     mw.util.addPortletLink(....);
> >   } );
> > });
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to