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:
Stephen Niedzielski 2019-02-11 13:34:12 -07:00 committed by Jdlrobson
parent 985311dddd
commit c561fbc794
1 changed files with 2 additions and 2 deletions

View File

@ -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,