mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-04 20:18:23 +00:00
98b2dcf631
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
26 lines
563 B
JavaScript
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 ) );
|