mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-28 09:20:31 +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.
|
* 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 ) );
|
|
||||||
|
|
Loading…
Reference in a new issue