This may introduce a really large number of scopes and have undesirable performance effects, but we need to come up with a solution nonetheless.
Version: unspecified
Severity: enhancement
This may introduce a really large number of scopes and have undesirable performance effects, but we need to come up with a solution nonetheless.
Version: unspecified
Severity: enhancement
For the record, inside ResourceLoader context $ is a local variable provided by the ResourceLoader built-in closure.
See also bug 48886.
I suggest for standalone we introduce an module-intro/outro that is used to wrap around individual modules (not per file).
So e.g. dist/ve.core.js would be:
( function ( ve, $ ) {
}( VisualEditor, jQuery ) );
And in MediaWiki the same would effectively happen but on-demand by ResourceLoader (since we don't want to use a build system for MW, but instead work on the raw source files directly and have them build dynamically).
See bug 48886 for details, but the end result would be:
register(
..,
[ 'ext.visualEditor', 1234, ...., ['VisualEditor']
);
mw.loader.implement( 'ext.visualEditor.core', function ( $, ve ) {
} );
Rephrasing bug.
Problems:
Solution:
In MediaWiki, we moved away from the closures (IIFEs), see rMWadd9bd191fd4: resources: Strip '$' and 'mw' from file closures and rMW91f950d6b067: resourceloader: Remove obsolete aliases from closure. So I believe this is no longer desirable.