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:
parent
de95f57456
commit
198688fe5f
|
@ -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 );
|
||||
} );
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in New Issue