mediawiki-extensions-Popups/resources/ext.popups/schema.js
Sam Smith 98b2dcf631 Hygiene: Rename SchemaPopupsSamplingRate
The SchemaPopupsSamplingRate config variable is inconsistently named and
even forwarded to the client as wgPopupsSchemaPopupsSamplingRate.

Changes:
* SchemaPopupsSamplingRate -> PopupsSchemaSamplingRate
* Forward PopupsSchemaSamplingRate to the client as
  $wgPopupsSchemaSamplingRate.

Bug: T146889
Bug: T146434
Change-Id: I80d6a0abccf462e2eb0fd96af6849b5e82b49c26
2017-01-15 11:01:00 -08:00

26 lines
563 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}
*/
mw.popups.createSchema = 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 ) );