@reactables/core 0.7.1-alpha.2 → 0.7.1-alpha.4
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 +6 -14
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var operators = require('rxjs/operators');
|
|
6
6
|
var rxjs = require('rxjs');
|
|
7
|
+
var jsonDiff = require('json-diff');
|
|
7
8
|
|
|
8
9
|
/******************************************************************************
|
|
9
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -136,26 +137,17 @@ var HubFactory = function (_a) {
|
|
|
136
137
|
var debugName = "[Rx Name] ".concat(name || 'undefined', " - ");
|
|
137
138
|
var seedState = initialState !== undefined ? initialState : reducer();
|
|
138
139
|
var state$ = messages$.pipe(operators.tap(function (action) {
|
|
139
|
-
debug && console.log(debugName, '[
|
|
140
|
+
debug && console.log(debugName, '[Action]', action);
|
|
140
141
|
}), operators.scan(reducer, seedState), operators.startWith(null, seedState), operators.pairwise(), operators.tap(function (_a) {
|
|
141
142
|
var prevState = _a[0], newState = _a[1];
|
|
142
143
|
if (debug) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
console.log(debugName, '[State changed] State:', newState);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
console.log(debugName, '[State unchanged] State:', newState);
|
|
149
|
-
}
|
|
144
|
+
console.log(debugName, '[State] State:', newState);
|
|
145
|
+
console.log(debugName, '[Diff]:', jsonDiff.diff(prevState, newState));
|
|
150
146
|
}
|
|
151
147
|
}), operators.map(function (pair) { return pair[1]; }));
|
|
152
148
|
if (storeValue) {
|
|
153
149
|
var replaySubject_1 = new rxjs.ReplaySubject(1);
|
|
154
|
-
state
|
|
155
|
-
.pipe(operators.takeWhile(function () {
|
|
156
|
-
return !replaySubject_1.closed;
|
|
157
|
-
}))
|
|
158
|
-
.subscribe(function (state) { return replaySubject_1.next(state); });
|
|
150
|
+
state$.subscribe(function (state) { return replaySubject_1.next(state); });
|
|
159
151
|
return replaySubject_1;
|
|
160
152
|
}
|
|
161
153
|
return state$;
|
|
@@ -176,7 +168,7 @@ var HubFactory = function (_a) {
|
|
|
176
168
|
};
|
|
177
169
|
|
|
178
170
|
var RxBuilder = function (_a) {
|
|
179
|
-
var effects = _a.effects, _b = _a.sources, sources = _b === void 0 ? [] : _b, _c = _a.debug, debug = _c === void 0 ? false : _c, _d = _a.storeValue, storeValue = _d === void 0 ?
|
|
171
|
+
var effects = _a.effects, _b = _a.sources, sources = _b === void 0 ? [] : _b, _c = _a.debug, debug = _c === void 0 ? false : _c, _d = _a.storeValue, storeValue = _d === void 0 ? false : _d, sliceConfig = __rest(_a, ["effects", "sources", "debug", "storeValue"]);
|
|
180
172
|
var _e = createSlice(sliceConfig), reducer = _e.reducer, actions = _e.actions;
|
|
181
173
|
// Check sources and see if need to add effects
|
|
182
174
|
if (!Array.isArray(sources)) {
|