mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-11 07:16:08 +00:00
26 lines
569 B
JavaScript
26 lines
569 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( 'wgPopupsSchemaPopupsSamplingRate', 0 );
|
||
|
|
||
|
if (
|
||
|
!window.navigator ||
|
||
|
!$.isFunction( window.navigator.sendBeacon ) ||
|
||
|
window.QUnit
|
||
|
) {
|
||
|
samplingRate = 0;
|
||
|
}
|
||
|
|
||
|
return new mw.eventLog.Schema( 'Popups', samplingRate );
|
||
|
};
|
||
|
|
||
|
}( mediaWiki, jQuery ) );
|