A fork of https://github.com/ueokande/vim-vixen
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.
31 lines
738 B
31 lines
738 B
7 years ago
|
import actions from 'content/actions';
|
||
7 years ago
|
|
||
|
const defaultState = {
|
||
|
enabled: false,
|
||
|
newTab: false,
|
||
7 years ago
|
background: false,
|
||
7 years ago
|
keys: '',
|
||
7 years ago
|
};
|
||
|
|
||
|
export default function reducer(state = defaultState, action = {}) {
|
||
|
switch (action.type) {
|
||
7 years ago
|
case actions.FOLLOW_CONTROLLER_ENABLE:
|
||
6 years ago
|
return { ...state,
|
||
7 years ago
|
enabled: true,
|
||
|
newTab: action.newTab,
|
||
7 years ago
|
background: action.background,
|
||
6 years ago
|
keys: '', };
|
||
7 years ago
|
case actions.FOLLOW_CONTROLLER_DISABLE:
|
||
6 years ago
|
return { ...state,
|
||
|
enabled: false, };
|
||
7 years ago
|
case actions.FOLLOW_CONTROLLER_KEY_PRESS:
|
||
6 years ago
|
return { ...state,
|
||
|
keys: state.keys + action.key, };
|
||
7 years ago
|
case actions.FOLLOW_CONTROLLER_BACKSPACE:
|
||
6 years ago
|
return { ...state,
|
||
|
keys: state.keys.slice(0, -1), };
|
||
7 years ago
|
default:
|
||
|
return state;
|
||
|
}
|
||
|
}
|