Since the startup payload varies by skin, the Gadgets extension should take advantage of this by not registering gadgets that are only enabled in certain skins.
|Open||SD0001||T253582 Let ResourceLoader only register skin modules for the current skin|
|Resolved||SD0001||T236603 Only register gadgets client-side from startup if relevant for the current skin|
This task is not about how modules are loaded (addModules), and not about how module content is defined (scripts/packagFiles etc).
The task is about when modules are registered. Registration reduction helps improve the startup module performance.
Registration can happen in one of two ways:
- Statically, from extension.json (or Resources.php) with an array or object for simple file modules.
- Dynamically, from the ResourceLoaderRegisterModules hook.
Gadgets are registered dynamically, since they are defined by end-users via MediaWiki:Gadgets-definition from a page.
There is a Gadget option called skins that gadget developers can use to indicate when the gadget module should load. The PHP code in the Gadgets extension uses this today to only call addModules in skins that the gadget supports.
The proposal is that for gadgets that use the skins option, to also only register them in skins that the gadget supports.