Remove usage of global event emitter from skins.minerva.talk/init.js

This patch removes usages of M.on (functionality derived from
moduleLoader.js in MobileFrontend) in skins.minerva.talk/init.js and
continues the work of I0e35776114ffa137b219eff0a900a0a0c52a27bb (patch
for MobileFrontend).

This patch and the patch for MobileFrontend should be merged together as
they both depend on eachother.

Depends-On: I0e35776114ffa137b219eff0a900a0a0c52a27bb
Bug: T156186
Change-Id: Ic766d0bbf2746df898038115e2e4bc791ac10359
This commit is contained in:
Nicholas Ray 2018-12-04 15:05:46 -07:00
parent fe983c5102
commit 8feff10336
1 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
( function ( M ) {
( function ( M, EventEmitter ) {
var loader = M.require( 'mobile.startup/rlModuleLoader' ),
LoadingOverlay = M.require( 'mobile.startup/LoadingOverlay' ),
eventBus = new EventEmitter(),
$talk = $( '.talk' ),
// use the plain return value here - T128273
title = $talk.attr( 'data-title' ),
@ -42,7 +43,8 @@
// T184273 using `getCurrentPage` because 'wgPageName' contains underscores instead of
// spaces.
currentPageTitle: M.getCurrentPage().title,
licenseMsg: skin.getLicenseMsg()
licenseMsg: skin.getLicenseMsg(),
eventBus: eventBus
};
return loader.loadModule( 'mobile.talk.overlays' ).then( function () {
@ -78,7 +80,7 @@
if ( inTalkNamespace ) {
// reload the page after the new discussion was added
M.on( 'talk-added-wo-overlay', function () {
eventBus.on( 'talk-added-wo-overlay', function () {
var loadingOverlay = new LoadingOverlay();
window.location.hash = '';
@ -90,4 +92,4 @@
}, 10 );
} );
}
}( mw.mobileFrontend ) );
}( mw.mobileFrontend, OO.EventEmitter ) );