p5.js-web-editor/client/modules/IDE/reducers/editorAccessibility.js
2018-05-08 19:16:04 -07:00

24 lines
655 B
JavaScript

import * as ActionTypes from '../../../constants';
const initialState = {
lintMessages: []
};
let messageId = 0;
const editorAccessibility = (state = initialState, action) => {
switch (action.type) {
case ActionTypes.UPDATE_LINT_MESSAGE:
messageId += 1;
return Object.assign({}, state, {
lintMessages: state.lintMessages.concat({
severity: action.severity, line: action.line, message: action.message, id: messageId
})
});
case ActionTypes.CLEAR_LINT_MESSAGE:
return Object.assign({}, state, { lintMessages: [] });
default:
return state;
}
};
export default editorAccessibility;