Re: [Wikitech-l] resource loader; 1.32 alpha; 1.32 stable breaking change, loading scripts in widgets

2019-04-05 Thread Tom Schulze
I agree with Bartosz Dziewoński. However, after checking out the code, I think the reason why I need to change the RLQ push statements is due to the resources/src/mediawiki.base/mediawiki.base.js modifications in v1.32 stable. window.RLQ = { push: function ( entry ) { if ( typeof entry ===

Re: [Wikitech-l] resource loader; 1.32 alpha; 1.32 stable breaking change loading scripts in widgets

2019-04-04 Thread bawolff
I don't know if its best practise to do this, but core seems to do: (window.RLQ=window.RLQ||[]).push(function () { mw.loader.using('ext.myextension').then(function(){ console.log('library loaded');}); }); You probably don't have many other options if you are using the Widgets extension. --

Re: [Wikitech-l] resource loader; 1.32 alpha; 1.32 stable breaking change loading scripts in widgets

2019-04-04 Thread Bartosz Dziewoński
Best practice is to use the PHP methods which generate the required wrappers. Have a look at ResourceLoader::makeLoaderConditionalScript() and ResourceLoader::makeInlineCodeWithModule(). Alternatively, if it's possible, it is ideal to put the initialization code into another module and load

[Wikitech-l] resource loader; 1.32 alpha; 1.32 stable breaking change loading scripts in widgets

2019-04-04 Thread Tom Schulze
dear all, i experienced breaking changes when loading scripts in the widgets extension through the resource loader. please check the gitlab snippet [1] i created. i did not find any documentation and checked the migration guide [2]. is the code presented in the gitlab snippet good practice?