### Frontend
mw.loader is naturally quite separate from other MediaWiki JS modules. Mainly, because it has to - it's the first thing that loads.
* [ ] Decide whether to abstract or configure the ResourceLoader Client.
* [ ] Implement the abstraction or configuration as needed.
* [ ] ??? Identify other aspects of mw.loader that might be MW-specific.
There are a few configuration options that change mw.loader behaviour, such as where `load.php` is. We can:
* Abstract mw.loader as something else and create an instance of it as `mw.loader` (e.g. factory function or constructor).
* Rename mw.loader and configure statically through properties.
```name=abstract.js,lang=js
import 'rl-client.js';
mw.loader = RLClient.create( { x: 'y' } );
```
```name=static.js,lang=js
import 'rl-client.js';
RLClient.config.x = 'y';
```
### Backend
When ResourceLoader was first written, and shortly before this task was filed, it was mostly MW-agnostic.
Having said that, a few things have crept in over the years.
* {icon check} Use of MW `cacheEpoch`. This is no longer useful. Remove. – <https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/460462/>
* {icon check} Use of WebRequest GPC normalisation. This was unintentional (we didn't have getRawVal yet in 2010). Remove. <https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/313222/>
* {icon check} Use of FormatJson. No longer needed with our PHP requirements. Remove. <https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/453194/>
* {icon check
* [ ] Use of `Xml::encodeJsCall`. Pretty trivial. Create a simplified version as private utility method instead.
* [ ] `ResourceLoader::__construct()` hardcodes registration of sources and modules for MediaWiki.
** {icon check} Create service writing for ResourceLoader. – <https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/491018/>
** [ ] Move the hooks and calls to `addSource()` and `register()` to MediaWiki service wiring.
* ...
* ???
* ...
>>! Original task description
> Just like the backend, the front-end should be less tied into MediaWiki base as well.
>
> It sounds more complicated than it really is though. All we need to do is move mw.loader into a separate file and create an instance of it in mw.loader.
>
> It's already an object constructor, except that right now it is instantly-instantiating an anonymous object constructor (this.loader = new (function(){ ... }));