mediawiki-extensions-Popups/src/schema.js
joakin fa2b10a2e7 Hygiene: Move build/ext.popups/ to src/
This way, src contains sources, and dist contains distribution files.

Also, add some documentation about the folders in the README and an adr.

Change-Id: Ie0b9f6475b8423b90e927633d883bde3cd5d5e4d
2017-02-14 09:59:59 -08:00

26 lines
555 B
JavaScript

( function ( mw, $ ) {
/**
* Creates an instance of an EventLogging schema that can be used to log
* Popups events.
*
* @param {mw.Map} config
* @param {Window} window
* @return {mw.eventLog.Schema}
*/
module.exports = function ( config, window ) {
var samplingRate = config.get( 'wgPopupsSchemaSamplingRate', 0 );
if (
!window.navigator ||
!$.isFunction( window.navigator.sendBeacon ) ||
window.QUnit
) {
samplingRate = 0;
}
return new mw.eventLog.Schema( 'Popups', samplingRate );
};
}( mediaWiki, jQuery ) );