Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4133397
ve.track.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
ve.track.js
View Options
/*!
* VisualEditor tracking methods.
*
* @copyright See AUTHORS.txt
*/
(
function
()
{
const
callbacks
=
$
.
Callbacks
(
'memory'
),
queue
=
[];
/**
* Track an analytic event.
*
* VisualEditor uses this method internally to track internal changes of state that are of analytic
* interest, either because they provide data about how users interact with the editor, or because
* they contain exception info, latency measurements, or other metrics that help gauge performance
* and reliability. VisualEditor does not transmit these events by default, but it provides a
* generic interface for routing these events to an analytics framework.
*
* @memberof ve
* @param {string} topic Event name
* @param {Object} [data] Additional data describing the event, encoded as an object
*/
ve
.
track
=
function
(
topic
,
data
)
{
queue
.
push
(
{
topic
:
topic
,
timeStamp
:
ve
.
now
(),
data
:
data
}
);
callbacks
.
fire
(
queue
);
};
/**
* Register a handler for subset of analytic events, specified by topic
*
* Handlers will be called once for each tracked event, including any events that fired before the
* handler was registered, with the topic, event data payload, and event timestamp as the first,
* second, and third arguments, respectively.
*
* @memberof ve
* @param {string} topic Handle events whose name starts with this string prefix
* @param {Function} callback Handler to call for each matching tracked event
*/
ve
.
trackSubscribe
=
function
(
topic
,
callback
)
{
let
seen
=
0
;
callbacks
.
add
(
(
q
)
=>
{
let
event
;
for
(
;
seen
<
q
.
length
;
seen
++
)
{
event
=
q
[
seen
];
if
(
event
.
topic
.
indexOf
(
topic
)
===
0
)
{
callback
(
event
.
topic
,
event
.
data
,
event
.
timeStamp
);
}
}
}
);
};
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 12:07 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ab/c5/7d7b793623e14a895c546b9b9ba3
Default Alt Text
ve.track.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment