aboutsummaryrefslogtreecommitdiff
path: root/src/content/reducers/input.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 15:19:25 +0900
committerGitHub <noreply@github.com>2017-10-08 15:19:25 +0900
commit0183161145d36cbafb7dbd86ca3a1aac6faca43f (patch)
treeaed757bfb5f8789156439d1e1fdff4e221376aaa /src/content/reducers/input.js
parent0f54a203dba38acdd080a928cee95f875fe84706 (diff)
parent57f798044d32ba7f9dc10a34ac31ad5dbdbf56ae (diff)
Merge pull request #22 from ueokande/separate-domains
Refactor: Separate domains
Diffstat (limited to 'src/content/reducers/input.js')
-rw-r--r--src/content/reducers/input.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/content/reducers/input.js b/src/content/reducers/input.js
new file mode 100644
index 0000000..802020f
--- /dev/null
+++ b/src/content/reducers/input.js
@@ -0,0 +1,20 @@
+import actions from 'content/actions';
+
+const defaultState = {
+ keys: '',
+};
+
+export default function reducer(state = defaultState, action = {}) {
+ switch (action.type) {
+ case actions.INPUT_KEY_PRESS:
+ return Object.assign({}, state, {
+ keys: state.keys + action.key
+ });
+ case actions.INPUT_CLEAR_KEYS:
+ return Object.assign({}, state, {
+ keys: '',
+ });
+ default:
+ return state;
+ }
+}