diff options
Diffstat (limited to 'src/content/reducers')
| -rw-r--r-- | src/content/reducers/index.js | 3 | ||||
| -rw-r--r-- | src/content/reducers/input.js | 7 | ||||
| -rw-r--r-- | src/content/reducers/setting.js | 13 | 
3 files changed, 17 insertions, 6 deletions
| diff --git a/src/content/reducers/index.js b/src/content/reducers/index.js index 7cf318e..ae4a845 100644 --- a/src/content/reducers/index.js +++ b/src/content/reducers/index.js @@ -1,10 +1,12 @@  import addonReducer from './addon'; +import settingReducer from './setting';  import inputReducer from './input';  import followReducer from './follow';  // Make setting reducer instead of re-use  const defaultState = {    addon: addonReducer(undefined, {}), +  setting: settingReducer(undefined, {}),    input: inputReducer(undefined, {}),    follow: followReducer(undefined, {}),  }; @@ -12,6 +14,7 @@ const defaultState = {  export default function reducer(state = defaultState, action = {}) {    return Object.assign({}, state, {      addon: addonReducer(state.addon, action), +    setting: settingReducer(state.setting, action),      input: inputReducer(state.input, action),      follow: followReducer(state.follow, action),    }); diff --git a/src/content/reducers/input.js b/src/content/reducers/input.js index c79b206..9457604 100644 --- a/src/content/reducers/input.js +++ b/src/content/reducers/input.js @@ -1,8 +1,7 @@  import actions from 'content/actions';  const defaultState = { -  keys: '', -  keymaps: {}, +  keys: ''  };  export default function reducer(state = defaultState, action = {}) { @@ -15,10 +14,6 @@ export default function reducer(state = defaultState, action = {}) {      return Object.assign({}, state, {        keys: '',      }); -  case actions.INPUT_SET_KEYMAPS: -    return Object.assign({}, state, { -      keymaps: action.keymaps, -    });    default:      return state;    } diff --git a/src/content/reducers/setting.js b/src/content/reducers/setting.js new file mode 100644 index 0000000..22fac6f --- /dev/null +++ b/src/content/reducers/setting.js @@ -0,0 +1,13 @@ +import actions from 'content/actions'; + +const defaultState = {}; + +export default function reducer(state = defaultState, action = {}) { +  switch (action.type) { +  case actions.SETTING_SET: +    return Object.assign({}, action.value); +  default: +    return state; +  } +} + | 
