diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-16 23:17:42 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-16 23:17:42 +0900 |
commit | fb1d3b5962531a004bb14f7f78796f77149ee7e7 (patch) | |
tree | dada8e3075c5aa149e5b25f1a7e460594132f195 /src/store/index.js | |
parent | bf75603e1514e64cd608fb90f4c47afeec5c37f9 (diff) |
add store test and fix store
Diffstat (limited to 'src/store/index.js')
-rw-r--r-- | src/store/index.js | 7 |
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() { |