From fb1d3b5962531a004bb14f7f78796f77149ee7e7 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 16 Sep 2017 23:17:42 +0900 Subject: add store test and fix store --- src/store/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') 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() { -- cgit v1.2.3