mediawiki-skins-MinervaNeue/resources/skins.minerva.scripts/initLogging.js
jdlrobson 01dc9de92e Minerva is responsible for turning on WikimediaEvents itself
Unlike other skins, Minerva wants to be in charge of when WikimediaEvents
is loaded, so that it can guarantee load order happens at a time that
suits it.

WikimediaEvents will be loaded after initialisation of the interface.
This allows Minerva to enable schemas such as ReadingDepth conditionally.

Upon merging this patch, Ibb45f40ea301727c0c6480043760bd9426106845 can
be merged which will revoke WikimediaEvent's ownership.
Merging in this order will ensure that ReadingDepth  is never
removed from production.

Bug: T204144
Change-Id: If8395033f31485aca0ca3b38fda1be985369b481
2018-09-19 22:09:26 +00:00

19 lines
599 B
JavaScript

// This initialises EventLogging for main menu and some prominent links in the UI.
// This code should only be loaded on the Minerva skin, it does not apply to other skins.
( function ( M, $ ) {
var mainMenu = M.require( 'skins.minerva.scripts.top/mainMenu' );
/**
* Enable WikimediaEvents including ReadingDepth schema
*/
function subscribeToWikimediaEvents() {
mw.loader.using( 'ext.wikimediaEvents' );
}
$( function () {
mainMenu.enableLogging();
} );
M.define( 'skins.minerva.scripts/subscribeToWikimediaEvents', subscribeToWikimediaEvents );
}( mw.mobileFrontend, jQuery ) );