mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-11 23:36:07 +00:00
3f2752b039
Action changes: * Include whether the user is logged in/out and information about the current page in the BOOT action. * Add the EVENT_LOGGED action, which represents the eventLoggined change listener logging the queued event. Reducer changes: * Move all tokens and timing information from the preview reducer to the eventLogging reducer. * Make the eventLogging reducer reset the state. Changes: * Add the mw.popups.createSchema function, which constructs an instance of the mw.eventLog.Schema object that can be used to log Popups events. * Add the eventLogging change listener, which logs the queued event. * Add hand-crafted, artisanal documentation. Bug: T152225 Change-Id: I8a3f58358b211cc55417dcda7e796fe538e3d910
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 ) );
|