Page MenuHomePhabricator

Load modules and settings
Closed, ResolvedPublic

Description

Loading for modules (Javascript and CSS) and settings need to be loaded for the gadget. ResourceLoader can not be used for this, instead this needs to be done in a module. Cleanest way is probably to create new module (gadget loader) that takes care of all this and calls ext.wikispeech.main.

Global settings, i.e. those in the extension config, can live on the producer. These will be the defaults, possibly they could be overwritten by settings stored on the consumer. Same goes for default user settings.

Event Timeline

The config and default user options were possible to load using ResourceLoader. That means they will be up to date with any changes in extension.json automatically.

I'm having an issue with loading the ext.wikispeech module. For some reason, I can't use mw.loader.using() in the gadget script; it never triggers. When I call it in the console after loading the script it does work. This means that there is a race condition where the gadget script crashes if the ext.wikispeech module hasn't loaded.

It looks like this is solved by registering the module with mw.loader.register() and passing "anotherwiki" as source. There is now a GET request on the consumer that looks something like this:
https://sv.wikipedia.org/wiki/undefined?lang=sv&modules=ext.wikispeech&skin=vector&version=ztntf which returns error 404 (unsurprisingly). Not sure what does that exactly, but it doesn't seem to actually break anything.

Change 685428 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[mediawiki/extensions/Wikispeech@master] Run Wikispeech as a gadget

https://gerrit.wikimedia.org/r/685428

Change 685428 merged by jenkins-bot:

[mediawiki/extensions/Wikispeech@master] Run Wikispeech as a gadget

https://gerrit.wikimedia.org/r/685428