Hygiene: update categoryOverlay to use factory API
- Revise M.require( 'mobile.categories.overlays/CategoryOverlay' ) to 'mobile.categories.overlays/categoryOverlay' (lowercase c). - The category overlay is a factory function not a class. Replace new operator with function invocation. This only looked strange and didn't break anything since the new operator uses the returned value if specified, not `this`, which was the result of the factory function and the OverlayManager understands both Overlays and functions that return Overlays. Bug: T208915 Change-Id: Ife098ee5ed1a8a164a4e31013a490076658f4147
This commit is contained in:
parent
985311dddd
commit
c561fbc794
|
@ -15,13 +15,13 @@
|
|||
// categories overlay
|
||||
overlayManager.add( /^\/categories$/, function () {
|
||||
return loader.loadModule( 'mobile.categories.overlays', true ).then( function ( loadingOverlay ) {
|
||||
var CategoryOverlay = M.require( 'mobile.categories.overlays/CategoryOverlay' );
|
||||
var categoryOverlay = M.require( 'mobile.categories.overlays/categoryOverlay' );
|
||||
eventBus.on( 'category-added', function () {
|
||||
window.location.hash = '#/categories';
|
||||
} );
|
||||
|
||||
loadingOverlay.hide();
|
||||
return new CategoryOverlay( {
|
||||
return categoryOverlay( {
|
||||
api: new mw.Api(),
|
||||
isAnon: isAnon,
|
||||
title: M.getCurrentPage().title,
|
||||
|
|
Loading…
Reference in New Issue