Ori.livneh has submitted this change and it was merged.

Change subject: ve#track: refactor callback calling convention
......................................................................


ve#track: refactor callback calling convention

It's a bit weird to call ve#track subscribers with a custom context object that
only supplies one useful property (this.timeStamp). So instead pass the
timestamp as the third parameter, and make the context null.

Change-Id: I8e82acc1219fb91181d2df3593baaedb54fe0b21
---
M src/ve.track.js
1 file changed, 3 insertions(+), 5 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/ve.track.js b/src/ve.track.js
index 3358064..0cc7220 100644
--- a/src/ve.track.js
+++ b/src/ve.track.js
@@ -30,10 +30,8 @@
         * 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; 'this' is set to a plain object with a 
'timeStamp' property indicating
-        * the exact time at which the event fired, a string 'topic' property 
naming the event, and a
-        * 'data' property which is an object of event-specific data. The event 
topic and event data are
-        * also passed to the callback as the first and second arguments, 
respectively.
+        * handler was registered, with the topic, event data payload, and 
event timestamp as the first,
+        * second, and third arguments, respectively.
         *
         * @member ve
         * @param {string} topic Handle events whose name starts with this 
string prefix
@@ -47,7 +45,7 @@
                        for ( ; seen < queue.length; seen++ ) {
                                event = queue[ seen ];
                                if ( event.topic.indexOf( topic ) === 0 ) {
-                                       callback.call( event, event.topic, 
event.data );
+                                       callback( event.topic, event.data, 
event.timeStamp );
                                }
                        }
                } );

-- 
To view, visit https://gerrit.wikimedia.org/r/191998
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8e82acc1219fb91181d2df3593baaedb54fe0b21
Gerrit-PatchSet: 3
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to