Hygiene: update talkOverlay to use factory API

- Revise M.require( 'mobile.talk.overlays/TalkOverlay' ) to
  'mobile.talk.overlays/talkOverlay' (lowercase t).

- 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: I496f78c24c485d88b046bac6889c7ff09267b250
This commit is contained in:
Stephen Niedzielski 2019-02-11 14:27:17 -07:00
parent de95f57456
commit 198688fe5f
1 changed files with 6 additions and 8 deletions

View File

@ -51,16 +51,14 @@
};
return loader.loadModule( 'mobile.talk.overlays' ).then( function () {
var Overlay;
if ( id === 'new' ) {
Overlay = M.require( 'mobile.talk.overlays/TalkSectionAddOverlay' );
} else if ( id ) {
talkOptions.id = id;
Overlay = M.require( 'mobile.talk.overlays/TalkSectionOverlay' );
} else {
Overlay = M.require( 'mobile.talk.overlays/TalkOverlay' );
return new ( M.require( 'mobile.talk.overlays/TalkSectionAddOverlay' ) )( talkOptions );
}
return new Overlay( talkOptions );
if ( id ) {
talkOptions.id = id;
return new ( M.require( 'mobile.talk.overlays/TalkSectionOverlay' ) )( talkOptions );
}
return M.require( 'mobile.talk.overlays/talkOverlay' )( talkOptions );
} );
} );