/
githubmirror
/
algorithm-visualizer
Обзор
Документация
Войти
/
githubmirror
/
algorithm-visualizer
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/reducers/player.js
30 строк
720 B
Jason Park
Separate backend from algorithm-visualizer repo
08 июн 2019, 20:59
08 июн 2019, 20:59
faae63b
Код
Авторство
О чём код?
import { combineActions, createAction, handleActions } from 'redux-actions'; const prefix = 'PLAYER'; const setChunks = createAction(`${prefix}/SET_CHUNKS`, chunks => ({ chunks })); const setCursor = createAction(`${prefix}/SET_CURSOR`, cursor => ({ cursor })); const setLineIndicator = createAction(`${prefix}/SET_LINE_INDICATOR`, lineIndicator => ({ lineIndicator })); export const actions = { setChunks, setCursor, setLineIndicator, }; const defaultState = { chunks: [], cursor: 0, lineIndicator: undefined, }; export default handleActions({ [combineActions( setChunks, setCursor, setLineIndicator, )]: (state, { payload }) => ({ ...state, ...payload, }), }, defaultState);