mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-12 15:55:19 +00:00
32 lines
667 B
JavaScript
32 lines
667 B
JavaScript
|
( function ( popups, nextState ) {
|
||
|
|
||
|
/**
|
||
|
* Reducer for actions that modify the state of the settings
|
||
|
*
|
||
|
* @param {Object} state
|
||
|
* @param {Object} action
|
||
|
* @return {Object} state after action
|
||
|
*/
|
||
|
popups.reducers.settings = function ( state, action ) {
|
||
|
if ( state === undefined ) {
|
||
|
state = {
|
||
|
shouldShow: false
|
||
|
};
|
||
|
}
|
||
|
|
||
|
switch ( action.type ) {
|
||
|
case popups.actionTypes.SETTINGS_SHOW:
|
||
|
return nextState( state, {
|
||
|
shouldShow: true
|
||
|
} );
|
||
|
case popups.actionTypes.SETTINGS_HIDE:
|
||
|
return nextState( state, {
|
||
|
shouldShow: false
|
||
|
} );
|
||
|
default:
|
||
|
return state;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
}( mediaWiki.popups, mediaWiki.popups.nextState ) );
|