Skip to content

Commit 5eeb17a

Browse files
committed
Check whether liftedStore is initiated
1 parent 58ada97 commit 5eeb17a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/app/store/createDevStore.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default function createDevToolsStore(onDispatch) {
77
currentStateIndex: 0
88
};
99
let listeners = [];
10+
let initiated = false;
1011

1112
function dispatch(action) {
1213
if (action.type[0] !== '@') onDispatch(action);
@@ -17,9 +18,14 @@ export default function createDevToolsStore(onDispatch) {
1718
return currentState;
1819
}
1920

21+
function isSet() {
22+
return initiated;
23+
}
24+
2025
function setState(state) {
2126
currentState = state;
2227
listeners.forEach(listener => listener());
28+
initiated = true;
2329
}
2430

2531
function subscribe(listener) {
@@ -39,7 +45,8 @@ export default function createDevToolsStore(onDispatch) {
3945
dispatch,
4046
getState,
4147
setState,
42-
subscribe
48+
subscribe,
49+
isSet
4350
}
4451
};
4552
}

0 commit comments

Comments
 (0)