state.js 735 B

12345678910111213141516171819202122232425262728293031
  1. /** @module player/state */
  2. /**
  3. * state.js
  4. *
  5. * Collection of everything which has to do with state changes.
  6. **/
  7. /** actionTypes define what actions are handeled by the reducer. */
  8. export const actions = {
  9. setState: players => {
  10. return {
  11. type: 'SET_PLAYERS',
  12. players
  13. }
  14. }
  15. }
  16. console.log('State actions', actions)
  17. /** state definition */
  18. export const state = {}
  19. console.log('State state', state)
  20. /** reducer is called by the redux dispatcher and handles all component actions */
  21. export function reducer (state = [], action) {
  22. let nextState = state
  23. return nextState
  24. }
  25. /** sagas are asynchronous workers (JS generators) to handle the state. */
  26. export function * saga () {}