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
678 B

const Immutable = require('immutable');
import * as MuncherActions from '../../actions/board/muncher.actions';
import MuncherCtrl from '../../controllers/muncher.controller';
import { SETTINGS } from '../../App';
const initial = { x: 0, y: 0, frozen: false };
const reducer = (state = initial, action) => {
if (action.type !== MuncherActions.MUNCHER_ACTION) {
return state;
}
if (action.action === MuncherActions.UPDATE) {
return Immutable.Map(state)
.set('x', MuncherCtrl.getX())
.set('y', MuncherCtrl.getY())
.set('frozen', false)
.toObject();
}
return state;
};
export default reducer;