mediawiki-extensions-Popups/resources/ext.popups.schemaPopups/ext.popups.schemaPopups.js
jdlrobson c4460ba2ea Hygiene: Move logic for duplicate events into getMassagedData
Add tests.

Change-Id: I15c10f256432ab5bfa7bf7adb34764f84b17c439
2016-10-25 19:33:29 +00:00

20 lines
545 B
JavaScript

( function ( $, mw ) {
var previousLogData,
// Log the popup event as defined in the schema
// https://meta.wikimedia.org/wiki/Schema:Popups
schemaPopups = new mw.eventLog.Schema(
'Popups',
mw.popups.schemaPopups.getSamplingRate(),
mw.popups.schemaPopups.getDefaultValues()
);
mw.trackSubscribe( 'ext.popups.event', function ( topic, data ) {
data = mw.popups.schemaPopups.getMassagedData( data, previousLogData );
if ( data ) {
schemaPopups.log( data );
}
previousLogData = data;
} );
} )( jQuery, mediaWiki );