You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
694 B
24 lines
694 B
const Immutable = require('immutable');
|
|
|
|
import * as ScorebarActions from '../../actions/board/scorebar.actions';
|
|
import ScorebarCtrl from '../../controllers/scorebar.controller.js';
|
|
|
|
const initial = {
|
|
current: ScorebarCtrl.getCurrentScore(),
|
|
high: ScorebarCtrl.getHighScore(),
|
|
lives: ScorebarCtrl.getLives()
|
|
};
|
|
|
|
const reducer = (state = initial, action) => {
|
|
if (action.type !== ScorebarActions.SCOREBAR_ACTION) {
|
|
return state;
|
|
}
|
|
|
|
return Immutable.Map(state)
|
|
.set('current', ScorebarCtrl.getCurrentScore())
|
|
.set('high', ScorebarCtrl.getHighScore())
|
|
.set('lives', ScorebarCtrl.getLives())
|
|
.toObject();
|
|
};
|
|
|
|
export default reducer;
|
|
|