aboutsummaryrefslogtreecommitdiff
path: root/src/store/index.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-16 23:17:42 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-16 23:17:42 +0900
commitfb1d3b5962531a004bb14f7f78796f77149ee7e7 (patch)
treedada8e3075c5aa149e5b25f1a7e460594132f195 /src/store/index.js
parentbf75603e1514e64cd608fb90f4c47afeec5c37f9 (diff)
add store test and fix store
Diffstat (limited to 'src/store/index.js')
-rw-r--r--src/store/index.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/store/index.js b/src/store/index.js
index a0a7791..2d08296 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -2,8 +2,12 @@ class Store {
constructor(reducer, catcher) {
this.reducer = reducer;
this.catcher = catcher;
- this.state = this.reducer(undefined, {});
this.subscribers = [];
+ try {
+ this.state = this.reducer(undefined, {});
+ } catch (e) {
+ catcher(e);
+ }
}
dispatch(action, sender) {
@@ -20,6 +24,7 @@ class Store {
this.catcher(e, sender);
}
}
+ return action
}
getState() {