Do not lazy-load an event logging module

Since we're always depending on the event logging module, we can
make it a dependency in extension.json, rather than loading it
lazily.

Bug: T157375
Change-Id: Ia57f390586e123c6010a7daf23a3d851daf079ce
This commit is contained in:
Baha 2017-03-06 13:39:57 -05:00
parent bf7a9a5b37
commit 13c630343e
2 changed files with 5 additions and 6 deletions

View file

@ -84,6 +84,7 @@
"mediawiki.Uri", "mediawiki.Uri",
"mediawiki.viewport", "mediawiki.viewport",
"ext.relatedArticles.readMore.gateway", "ext.relatedArticles.readMore.gateway",
"ext.relatedArticles.readMore.eventLogging",
"jquery.throttle-debounce" "jquery.throttle-debounce"
], ],
"targets": [ "targets": [
@ -93,7 +94,8 @@
}, },
"ext.relatedArticles.readMore": { "ext.relatedArticles.readMore": {
"dependencies": [ "dependencies": [
"mediawiki.util" "mediawiki.util",
"ext.relatedArticles.readMore.eventLogging"
], ],
"scripts": [ "scripts": [
"resources/ext.relatedArticles.readMore/index.js" "resources/ext.relatedArticles.readMore/index.js"

View file

@ -60,8 +60,7 @@
// which should never happen given the if statement. // which should never happen given the if statement.
mw.loader.using( [ mw.loader.using( [
'ext.cards', 'ext.cards',
'ext.relatedArticles.readMore', 'ext.relatedArticles.readMore'
'ext.relatedArticles.readMore.eventLogging'
] ), ] ),
relatedPages.getForCurrentPage( LIMIT ) relatedPages.getForCurrentPage( LIMIT )
).done( function ( _, pages ) { ).done( function ( _, pages ) {
@ -94,7 +93,5 @@
loadRelatedArticles(); loadRelatedArticles();
} }
mw.loader.using( 'ext.relatedArticles.readMore.eventLogging' ).done( function () { mw.track( 'ext.relatedArticles.logEnabled', { isEnabled: shouldShowReadMore } );
mw.track( 'ext.relatedArticles.logEnabled', { isEnabled: shouldShowReadMore } );
} );
}( jQuery, mediaWiki ) ); }( jQuery, mediaWiki ) );