mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 15:44:09 +00:00
Merge "Hygiene: Remove unnecessary IIFE in changeListeners/render.js"
This commit is contained in:
commit
8097314077
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map
vendored
BIN
resources/dist/index.js.map
vendored
Binary file not shown.
|
@ -1,23 +1,21 @@
|
|||
( function ( mw ) {
|
||||
var renderer = require( '../renderer' );
|
||||
|
||||
/**
|
||||
* Creates an instance of the render change listener.
|
||||
*
|
||||
* @param {ext.popups.PreviewBehavior} previewBehavior
|
||||
* @return {ext.popups.ChangeListener}
|
||||
*/
|
||||
module.exports = function ( previewBehavior ) {
|
||||
var preview;
|
||||
/**
|
||||
* Creates an instance of the render change listener.
|
||||
*
|
||||
* @param {ext.popups.PreviewBehavior} previewBehavior
|
||||
* @return {ext.popups.ChangeListener}
|
||||
*/
|
||||
module.exports = function ( previewBehavior ) {
|
||||
var preview;
|
||||
|
||||
return function ( prevState, state ) {
|
||||
if ( state.preview.shouldShow && !preview ) {
|
||||
preview = mw.popups.renderer.render( state.preview.fetchResponse );
|
||||
preview.show( state.preview.activeEvent, previewBehavior );
|
||||
} else if ( !state.preview.shouldShow && preview ) {
|
||||
preview.hide();
|
||||
preview = undefined;
|
||||
}
|
||||
};
|
||||
return function ( prevState, state ) {
|
||||
if ( state.preview.shouldShow && !preview ) {
|
||||
preview = renderer.render( state.preview.fetchResponse );
|
||||
preview.show( state.preview.activeEvent, previewBehavior );
|
||||
} else if ( !state.preview.shouldShow && preview ) {
|
||||
preview.hide();
|
||||
preview = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
}( mediaWiki ) );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue