https://bugzilla.wikimedia.org/show_bug.cgi?id=48886

       Web browser: ---
            Bug ID: 48886
           Summary: ResourceLoader: Solution to get rid of duplicate
                    closures in production
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: ResourceLoader
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Situation:
* ResourceLoader wraps modules in closures
* MediaWiki developers put a closure in each file
* As a result loading 1 module with 2 files will have 3 closures

mw.loader.implement( 'foo', function ( $ ) {
  --- foo.a.js
  ( function ( $, mw ) { 
    ...
  }( jQuery, mediaWiki ) )

  --- foo.b.js
  ( function ( $, mw ) { 
    ...
  }( jQuery, mediaWiki ) )
} );


mw.loader#
  script( jQuery );


It has been suggested we add "mw" to ResourceLoader's closure and get rid of
the per-file closure.

The downside of doing that would be that they are less safe to use
"standalone". e.g. a jquery plugin would be using $ directly, which, outside
MediaWiki ResourceLoader context is bad.

There is also the pending refactoring of ResourceLoader debug mode to not be
completely different and near useless by executing in the global scope.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to