@reactables/core 0.7.0-alpha.1 → 0.7.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63,12 +63,12 @@ var addEffects = function (actionCreator, scopedEffects) {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
var createSlice = function (config) {
|
|
66
|
-
var
|
|
66
|
+
var initialState = config.initialState, reducers = config.reducers;
|
|
67
67
|
var reducer = Object.entries(reducers).reduce(function (acc, _a) {
|
|
68
68
|
var key = _a[0], _case = _a[1];
|
|
69
69
|
var _reducer = typeof _case === 'function' ? _case : _case.reducer;
|
|
70
70
|
var newFunc = function (state, action) {
|
|
71
|
-
if (action && action.type ===
|
|
71
|
+
if (action && action.type === key) {
|
|
72
72
|
return _reducer(state, action);
|
|
73
73
|
}
|
|
74
74
|
return acc(state, action);
|
|
@@ -81,7 +81,7 @@ var createSlice = function (config) {
|
|
|
81
81
|
var actions = Object.entries(reducers).reduce(function (acc, _a) {
|
|
82
82
|
var key = _a[0], _case = _a[1];
|
|
83
83
|
acc[key] = function (payload) { return ({
|
|
84
|
-
type:
|
|
84
|
+
type: key,
|
|
85
85
|
payload: payload
|
|
86
86
|
}); };
|
|
87
87
|
if (typeof _case !== 'function' && _case.effects) {
|
|
@@ -133,7 +133,7 @@ var HubFactory = function (_a) {
|
|
|
133
133
|
var messages$ = rxjs.merge.apply(void 0, __spreadArray([inputStream$, mergedScopedEffects], genericEffects, false)).pipe(operators.share());
|
|
134
134
|
var store = function (_a) {
|
|
135
135
|
var reducer = _a.reducer, name = _a.name, debug = _a.debug, initialState = _a.initialState, _b = _a.storeValue, storeValue = _b === void 0 ? false : _b;
|
|
136
|
-
var debugName = "[
|
|
136
|
+
var debugName = "[Rx Name] ".concat(name || 'undefined', " - ");
|
|
137
137
|
var seedState = initialState !== undefined ? initialState : reducer();
|
|
138
138
|
var state$ = messages$.pipe(operators.tap(function (action) {
|
|
139
139
|
debug && console.log(debugName, '[Message Received]', action);
|
|
@@ -142,7 +142,7 @@ var HubFactory = function (_a) {
|
|
|
142
142
|
if (debug) {
|
|
143
143
|
var hasDiff = prevState !== newState;
|
|
144
144
|
if (hasDiff) {
|
|
145
|
-
console.log(debugName, '[State changed]
|
|
145
|
+
console.log(debugName, '[State changed] State:', newState);
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
148
148
|
console.log(debugName, '[State unchanged] State:', newState);
|
|
@@ -203,7 +203,10 @@ var RxBuilder = function (_a) {
|
|
|
203
203
|
},
|
|
204
204
|
];
|
|
205
205
|
}));
|
|
206
|
-
return [
|
|
206
|
+
return [
|
|
207
|
+
hub.store({ reducer: reducer, debug: debug, storeValue: storeValue, name: sliceConfig.name }),
|
|
208
|
+
actionsResult,
|
|
209
|
+
];
|
|
207
210
|
};
|
|
208
211
|
|
|
209
212
|
exports.RxBuilder = RxBuilder;
|
package/package.json
CHANGED