mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
Tee tracked events to MediaWiki's mw.track
When running in the context of MediaWiki, VisualEditor should tee its event stream to MediaWiki's main event bus, mw.track(), so that MediaWiki event subscribers have a unified interface for subscribing to events. Each VisualEditor event topic is prefixed with 've.' To test this patch, you can use this snippet: mw.trackSubscribe( 've', function ( topic, data ) { console.log( this, topic, data ); } ); Change-Id: I6b3f10b0dd0aa7fa47c3b35e2fc554622960ce52
This commit is contained in:
parent
8e7a864e90
commit
753d87e618
|
@ -36,6 +36,13 @@
|
|||
var target = new ve.init.mw.ViewPageTarget();
|
||||
ve.init.mw.targets.push( target );
|
||||
|
||||
// Tee tracked events to MediaWiki firehose, if available (1.23+).
|
||||
if ( mw.track ) {
|
||||
ve.trackSubscribeAll( function ( topic, data ) {
|
||||
mw.track.call( null, 've.' + topic, data );
|
||||
} );
|
||||
}
|
||||
|
||||
// Transfer methods
|
||||
ve.init.mw.ViewPageTarget.prototype.setupSectionEditLinks = init.setupSectionLinks;
|
||||
|
||||
|
|
Loading…
Reference in a new issue