Merge "Hygiene: Remove unnecessary IIFE in changeListeners/render.js"

This commit is contained in:
jenkins-bot 2017-02-20 17:30:02 +00:00 committed by Gerrit Code Review
commit 8097314077
3 changed files with 18 additions and 20 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1,23 +1,21 @@
( function ( mw ) { var renderer = require( '../renderer' );
/** /**
* Creates an instance of the render change listener. * Creates an instance of the render change listener.
* *
* @param {ext.popups.PreviewBehavior} previewBehavior * @param {ext.popups.PreviewBehavior} previewBehavior
* @return {ext.popups.ChangeListener} * @return {ext.popups.ChangeListener}
*/ */
module.exports = function ( previewBehavior ) { module.exports = function ( previewBehavior ) {
var preview; var preview;
return function ( prevState, state ) { return function ( prevState, state ) {
if ( state.preview.shouldShow && !preview ) { if ( state.preview.shouldShow && !preview ) {
preview = mw.popups.renderer.render( state.preview.fetchResponse ); preview = renderer.render( state.preview.fetchResponse );
preview.show( state.preview.activeEvent, previewBehavior ); preview.show( state.preview.activeEvent, previewBehavior );
} else if ( !state.preview.shouldShow && preview ) { } else if ( !state.preview.shouldShow && preview ) {
preview.hide(); preview.hide();
preview = undefined; preview = undefined;
} }
}; };
}; };
}( mediaWiki ) );