Updated mediawiki/extensions
Project: mediawiki/extensions/VisualEditor  cec28fe28734d33afa44b4efad43056c4edf8dc2

Add ve.track, a generic dispatch of analytic events

This patch adds ve.track; it provides a means for VisualEditor code to log
various changes of state that are of potential analytic interest. This is done
without coupling VisualEditor to a particular analytics framework by providing
a method, ve.hook.registerHandler, by which event data may be routed to a
particular analytic framework for processing and dispatch.

ve.track uses a $.Callbacks-like object for tracking analytic events which can
remember an arbitrary number of past events. This is done by maintaining an
array containing the arguments of past calls and maintaining a counter for each
callback indicating its position in the queue (i.e., how many events it has
already received.) This ensures handlers are called for each event, including
events which were fired before the handler was registered. This allows the
load-order of VE and analytics components to remain unspecified.

Change-Id: I29740fa7a0ac403e484e0acee6dfcadaf6fc4566