mw.loader: Add 'require' as Promise value for using()
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 4 Aug 2016 23:04:37 +0000 (16:04 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 4 Aug 2016 23:37:30 +0000 (16:37 -0700)
commit2dc03ee268dc6777e475b4319254c81a1bbb1ed4
treed02ff1122715839268e073602906c2126291a4ce
parent88ffc3779f4287ba7e3db5f51feb43d099f281d4
mw.loader: Add 'require' as Promise value for using()

Discourage use of the global mw.loader.require method since it's contextless,
and doesn't allow for future expansion where we might detect missing declared
dependencies or could track stacking context.

In regular execution context, there is already a local require() method.

For ad-hoc loading through mw.loader.using() there is now a reference to a
require function.

This also discourages code from assuming that the internal implement() method
is synchronous - which may change after T142129.

Change-Id: Ia040729901b1e77da8d3bf4830bb076f8fa8c6e9
resources/src/mediawiki/mediawiki.js
tests/qunit/suites/resources/mediawiki/mediawiki.test.js