I wrote:
JS2 has been demerged out of trunk and into the
js2-work branch, so
that we can start making some progress again towards the release of
1.16, and the deployment of the current trunk to Wikimedia.
The relevant code is not ready for beta testing, the problems with it
are plain to see on code review. That's why I'm not comfortable with
the idea of promoting it as a core component at this stage.
It's been merged since July (r53282), but there's been very little
work on it by anyone other than Michael and I. So I don't think the
merge has had the desired effect of bringing it to the attention of a
wider developer community.
Roan has re-added js2/js2stopgap.js. I would prefer to see the JS2
functions in that file deprecated, and for extensions targeting 1.16
to use interfaces which we can more easily continue to support into
the future.
loadGM(), gM(): misnamed, neither should be global, excessively
abbreviated and unintelligible function names. I suggest adding
mw.getMsg() and mw.addMessages() to wikibits.js.
$j: idiosyncratic, what's wrong with calling jQuery jQuery like
everyone else?
function js2AddOnloadHook( func ) {
$j(document).ready( func );
}
The "js2" prefix will disappear from all interfaces in a future
version. Callers can just use jQuery(document).ready() directly.
mvJsLoader = { doLoad: function( deps, callback ) { callback(); } };
Note that mv is an abbreviation for Metavid, nothing that starts with
mv belongs in the core. Calls to this should just be removed for now,
since it doesn't do anything. There will eventually be a function
called mw.load() which does a similar thing.
The filename, js2/js2stopgap.js, has the problem of containing js2 not
once but twice. I have previously suggested adding an
OutputPage::addJQuery() interface, which removes the need to specify
the filename in the extension and can be designed to avoid the
possibility of duplicate script tags. I still think that this is a
good idea. Then the combined jQuery file can be moved to
skins/common/jquery.combined.js, and later moved again when we have
the ability to split it up into modules and to handle dependencies and
what not.
A more generic script inclusion interface will no doubt be established
at some stage, but its calling convention is not yet decided, so it
makes sense to have a single-purpose function which can later be
implemented in terms of the generic function, when it comes along.
With these changes, preview.js can easily be ported and re-added
without any other js2 code.
-- Tim Starling