aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/mediawiki.base
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2024-11-18 14:12:37 +0000
committerD3r1ck01 <dalangi-ctr@wikimedia.org>2024-11-18 20:21:41 +0000
commitca3044dd0af6a6edb6bd57189a3ebbb620f7389a (patch)
treeb35e3f7cb8d5c153663101ae4eeae191f529a7af /resources/src/mediawiki.base
parenta4dc5cf4549ea7688fcea4ae51b02cee6255c4a5 (diff)
downloadmediawikicore-ca3044dd0af6a6edb6bd57189a3ebbb620f7389a.tar.gz
mediawikicore-ca3044dd0af6a6edb6bd57189a3ebbb620f7389a.zip
ResourceLoader: Remove unused 'thisValue' from mw.trackSubscribe
This exposed the internal queue structure, which thus means that future changes to this structure are noticable through the public interface (mw.trackSubscribe callbacks). Those callbacks could rely on the presence of a specific property, or perhaps modify or merge it with something else, and thus also rely on the absence of certain properties that they added themselves before or after that merge. Avoid this by removing support for it. It was introduced in 2013 with I8c7af097e6 (873b60f194), but never used: https://codesearch.wmcloud.org/deployed/?q=mw.trackSubscribe%7Cthis%5C.topic%5Cb&files=js%24&excludeFiles=test%7Cnode_modules Change-Id: I2d9bc9b7228ab5f2df2160181f41c40cce8f42b6
Diffstat (limited to 'resources/src/mediawiki.base')
-rw-r--r--resources/src/mediawiki.base/mediawiki.base.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/resources/src/mediawiki.base/mediawiki.base.js b/resources/src/mediawiki.base/mediawiki.base.js
index fee7ecddd302..c72f79e5d11f 100644
--- a/resources/src/mediawiki.base/mediawiki.base.js
+++ b/resources/src/mediawiki.base/mediawiki.base.js
@@ -390,9 +390,8 @@ mw.track = function ( topic, data ) {
* Register a handler for subset of analytic events, specified by topic.
*
* Handlers will be called once for each tracked event, including for any buffered events that
- * fired before the handler was subscribed. The callback is passed a `topic` string, and optional
- * `data` event object. The `this` value for the callback is a plain object with `topic` and
- * `data` properties set to those same values.
+ * fired before the handler was subscribed. The callback is passed a `topic` string, and an optional
+ * `data` argument.
*
* @example
* // To monitor all topics for debugging
@@ -406,7 +405,7 @@ mw.track = function ( topic, data ) {
* @param {string} topic Handle events whose name starts with this string prefix
* @param {Function} callback Handler to call for each matching tracked event
* @param {string} callback.topic
- * @param {Object} [callback.data]
+ * @param {Object|number|string} [callback.data]
*/
mw.trackSubscribe = function ( topic, callback ) {
let seen = 0;
@@ -414,7 +413,7 @@ mw.trackSubscribe = function ( topic, callback ) {
for ( ; seen < trackQueue.length; seen++ ) {
const event = trackQueue[ seen ];
if ( event.topic.indexOf( topic ) === 0 ) {
- callback.call( event, event.topic, event.data );
+ callback( event.topic, event.data );
}
}
}