See also T58659: VisualEditor: Use mw.Api library in mw.Target instead of our own functions
Vague idea from past me that probably isn't worth keeping a task for.