Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5955572
useInstrument.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
useInstrument.js
View Options
'use strict'
;
/**
* Additional context for an instrumentation event.
*
* @typedef {Object} InteractionData
* @property {number} [sessionLength] The duration IP auto-reveal mode is enabled for, in seconds
*/
/**
* @callback LogEvent Log an event to the IP auto-reveal event stream.
*
* @param {string} action
* @param {InteractionData} [data]
*/
/**
* Composable to create an event logging function configured to log events to the
* IP auto-reveal event stream.
*
* @return {LogEvent}
*/
const
useInstrument
=
()
=>
{
if
(
!
mw
.
eventLog
)
{
// EventLogging is not installed
return
()
=>
{};
}
const
instrument
=
mw
.
eventLog
.
newInstrument
(
'mediawiki.product_metrics.checkuser_ip_auto_reveal_interaction'
,
'/analytics/product_metrics/web/base/1.4.2'
);
return
(
action
,
data
=
{}
)
=>
{
const
interactionData
=
{};
if
(
data
.
sessionLength
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_context
=
JSON
.
stringify
(
{
// eslint-disable-next-line camelcase
session_length
:
data
.
sessionLength
}
);
}
instrument
.
submitInteraction
(
action
,
interactionData
);
};
};
module
.
exports
=
useInstrument
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 03:47 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
48/af/382fe9192777ef527afb61b4b2d4
Default Alt Text
useInstrument.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment