@ngxs/devtools-plugin 3.7.4 → 3.7.5
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/README.md +3 -3
- package/bundles/ngxs-devtools-plugin.umd.js +387 -378
- package/bundles/ngxs-devtools-plugin.umd.js.map +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js.map +1 -1
- package/esm2015/index.js +9 -9
- package/esm2015/ngxs-devtools-plugin.js +9 -9
- package/esm2015/src/devtools.module.js +48 -48
- package/esm2015/src/devtools.plugin.js +229 -220
- package/esm2015/src/public_api.js +8 -8
- package/esm2015/src/symbols.js +78 -78
- package/esm5/index.js +9 -9
- package/esm5/ngxs-devtools-plugin.js +9 -9
- package/esm5/src/devtools.module.js +57 -57
- package/esm5/src/devtools.plugin.js +271 -262
- package/esm5/src/public_api.js +8 -8
- package/esm5/src/symbols.js +78 -78
- package/fesm2015/ngxs-devtools-plugin.js +349 -340
- package/fesm2015/ngxs-devtools-plugin.js.map +1 -1
- package/fesm5/ngxs-devtools-plugin.js +396 -387
- package/fesm5/ngxs-devtools-plugin.js.map +1 -1
- package/index.d.ts +4 -4
- package/ngxs-devtools-plugin.d.ts +5 -5
- package/package.json +2 -2
- package/src/devtools.module.d.ts +13 -13
- package/src/devtools.plugin.d.ts +31 -31
- package/src/public_api.d.ts +3 -3
- package/src/symbols.d.ts +39 -39
|
@@ -2,356 +2,365 @@ import { InjectionToken, ɵglobal, Injectable, Inject, Injector, NgZone, NgModul
|
|
|
2
2
|
import { Store, getActionTypeFromInstance, NGXS_PLUGINS } from '@ngxs/store';
|
|
3
3
|
import { catchError, tap } from 'rxjs/operators';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @fileoverview added by tsickle
|
|
7
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Interface for the redux-devtools-extension API.
|
|
11
|
-
* @record
|
|
12
|
-
*/
|
|
13
|
-
function NgxsDevtoolsExtension() { }
|
|
14
|
-
if (false) {
|
|
15
|
-
/**
|
|
16
|
-
* @param {?} state
|
|
17
|
-
* @return {?}
|
|
18
|
-
*/
|
|
19
|
-
NgxsDevtoolsExtension.prototype.init = function (state) { };
|
|
20
|
-
/**
|
|
21
|
-
* @param {?} action
|
|
22
|
-
* @param {?=} state
|
|
23
|
-
* @return {?}
|
|
24
|
-
*/
|
|
25
|
-
NgxsDevtoolsExtension.prototype.send = function (action, state) { };
|
|
26
|
-
/**
|
|
27
|
-
* @param {?} fn
|
|
28
|
-
* @return {?}
|
|
29
|
-
*/
|
|
30
|
-
NgxsDevtoolsExtension.prototype.subscribe = function (fn) { };
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @record
|
|
34
|
-
*/
|
|
35
|
-
function NgxsDevtoolsAction() { }
|
|
36
|
-
if (false) {
|
|
37
|
-
/** @type {?} */
|
|
38
|
-
NgxsDevtoolsAction.prototype.type;
|
|
39
|
-
/** @type {?} */
|
|
40
|
-
NgxsDevtoolsAction.prototype.payload;
|
|
41
|
-
/** @type {?} */
|
|
42
|
-
NgxsDevtoolsAction.prototype.state;
|
|
43
|
-
/** @type {?} */
|
|
44
|
-
NgxsDevtoolsAction.prototype.id;
|
|
45
|
-
/** @type {?} */
|
|
46
|
-
NgxsDevtoolsAction.prototype.source;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @record
|
|
50
|
-
*/
|
|
51
|
-
function NgxsDevtoolsOptions() { }
|
|
52
|
-
if (false) {
|
|
53
|
-
/**
|
|
54
|
-
* The name of the extension
|
|
55
|
-
* @type {?|undefined}
|
|
56
|
-
*/
|
|
57
|
-
NgxsDevtoolsOptions.prototype.name;
|
|
58
|
-
/**
|
|
59
|
-
* Whether the dev tools is enabled or note. Useful for setting during production.
|
|
60
|
-
* @type {?|undefined}
|
|
61
|
-
*/
|
|
62
|
-
NgxsDevtoolsOptions.prototype.disabled;
|
|
63
|
-
/**
|
|
64
|
-
* Max number of entiries to keep.
|
|
65
|
-
* @type {?|undefined}
|
|
66
|
-
*/
|
|
67
|
-
NgxsDevtoolsOptions.prototype.maxAge;
|
|
68
|
-
/**
|
|
69
|
-
* Reformat actions before sending to dev tools
|
|
70
|
-
* @type {?|undefined}
|
|
71
|
-
*/
|
|
72
|
-
NgxsDevtoolsOptions.prototype.actionSanitizer;
|
|
73
|
-
/**
|
|
74
|
-
* Reformat state before sending to devtools
|
|
75
|
-
* @type {?|undefined}
|
|
76
|
-
*/
|
|
77
|
-
NgxsDevtoolsOptions.prototype.stateSanitizer;
|
|
78
|
-
}
|
|
79
|
-
/** @type {?} */
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview added by tsickle
|
|
7
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Interface for the redux-devtools-extension API.
|
|
11
|
+
* @record
|
|
12
|
+
*/
|
|
13
|
+
function NgxsDevtoolsExtension() { }
|
|
14
|
+
if (false) {
|
|
15
|
+
/**
|
|
16
|
+
* @param {?} state
|
|
17
|
+
* @return {?}
|
|
18
|
+
*/
|
|
19
|
+
NgxsDevtoolsExtension.prototype.init = function (state) { };
|
|
20
|
+
/**
|
|
21
|
+
* @param {?} action
|
|
22
|
+
* @param {?=} state
|
|
23
|
+
* @return {?}
|
|
24
|
+
*/
|
|
25
|
+
NgxsDevtoolsExtension.prototype.send = function (action, state) { };
|
|
26
|
+
/**
|
|
27
|
+
* @param {?} fn
|
|
28
|
+
* @return {?}
|
|
29
|
+
*/
|
|
30
|
+
NgxsDevtoolsExtension.prototype.subscribe = function (fn) { };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @record
|
|
34
|
+
*/
|
|
35
|
+
function NgxsDevtoolsAction() { }
|
|
36
|
+
if (false) {
|
|
37
|
+
/** @type {?} */
|
|
38
|
+
NgxsDevtoolsAction.prototype.type;
|
|
39
|
+
/** @type {?} */
|
|
40
|
+
NgxsDevtoolsAction.prototype.payload;
|
|
41
|
+
/** @type {?} */
|
|
42
|
+
NgxsDevtoolsAction.prototype.state;
|
|
43
|
+
/** @type {?} */
|
|
44
|
+
NgxsDevtoolsAction.prototype.id;
|
|
45
|
+
/** @type {?} */
|
|
46
|
+
NgxsDevtoolsAction.prototype.source;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @record
|
|
50
|
+
*/
|
|
51
|
+
function NgxsDevtoolsOptions() { }
|
|
52
|
+
if (false) {
|
|
53
|
+
/**
|
|
54
|
+
* The name of the extension
|
|
55
|
+
* @type {?|undefined}
|
|
56
|
+
*/
|
|
57
|
+
NgxsDevtoolsOptions.prototype.name;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the dev tools is enabled or note. Useful for setting during production.
|
|
60
|
+
* @type {?|undefined}
|
|
61
|
+
*/
|
|
62
|
+
NgxsDevtoolsOptions.prototype.disabled;
|
|
63
|
+
/**
|
|
64
|
+
* Max number of entiries to keep.
|
|
65
|
+
* @type {?|undefined}
|
|
66
|
+
*/
|
|
67
|
+
NgxsDevtoolsOptions.prototype.maxAge;
|
|
68
|
+
/**
|
|
69
|
+
* Reformat actions before sending to dev tools
|
|
70
|
+
* @type {?|undefined}
|
|
71
|
+
*/
|
|
72
|
+
NgxsDevtoolsOptions.prototype.actionSanitizer;
|
|
73
|
+
/**
|
|
74
|
+
* Reformat state before sending to devtools
|
|
75
|
+
* @type {?|undefined}
|
|
76
|
+
*/
|
|
77
|
+
NgxsDevtoolsOptions.prototype.stateSanitizer;
|
|
78
|
+
}
|
|
79
|
+
/** @type {?} */
|
|
80
80
|
const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
* @fileoverview added by tsickle
|
|
84
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
85
|
-
*/
|
|
86
|
-
/** @enum {string} */
|
|
87
|
-
const ReduxDevtoolsActionType = {
|
|
88
|
-
Dispatch: 'DISPATCH',
|
|
89
|
-
Action: 'ACTION',
|
|
90
|
-
};
|
|
91
|
-
/** @enum {string} */
|
|
92
|
-
const ReduxDevtoolsPayloadType = {
|
|
93
|
-
JumpToAction: 'JUMP_TO_ACTION',
|
|
94
|
-
JumpToState: 'JUMP_TO_STATE',
|
|
95
|
-
ToggleAction: 'TOGGLE_ACTION',
|
|
96
|
-
ImportState: 'IMPORT_STATE',
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Adds support for the Redux Devtools extension:
|
|
100
|
-
* http://extension.remotedev.io/
|
|
101
|
-
*/
|
|
102
|
-
class NgxsReduxDevtoolsPlugin {
|
|
103
|
-
/**
|
|
104
|
-
* @param {?} _options
|
|
105
|
-
* @param {?} _injector
|
|
106
|
-
* @param {?} _ngZone
|
|
107
|
-
*/
|
|
108
|
-
constructor(_options, _injector, _ngZone) {
|
|
109
|
-
this._options = _options;
|
|
110
|
-
this._injector = _injector;
|
|
111
|
-
this._ngZone = _ngZone;
|
|
112
|
-
this.devtoolsExtension = null;
|
|
113
|
-
this.globalDevtools = ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];
|
|
114
|
-
this.unsubscribe = null;
|
|
115
|
-
this.connect();
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* @return {?}
|
|
119
|
-
*/
|
|
120
|
-
ngOnDestroy() {
|
|
121
|
-
if (this.unsubscribe !== null) {
|
|
122
|
-
this.unsubscribe();
|
|
123
|
-
}
|
|
124
|
-
if (this.globalDevtools) {
|
|
125
|
-
this.globalDevtools.disconnect();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Lazy get the store for circular dependency issues
|
|
130
|
-
* @private
|
|
131
|
-
* @return {?}
|
|
132
|
-
*/
|
|
133
|
-
get store() {
|
|
134
|
-
return this._injector.get(Store);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Middleware handle function
|
|
138
|
-
* @param {?} state
|
|
139
|
-
* @param {?} action
|
|
140
|
-
* @param {?} next
|
|
141
|
-
* @return {?}
|
|
142
|
-
*/
|
|
143
|
-
handle(state, action, next) {
|
|
144
|
-
if (!this.devtoolsExtension || this._options.disabled) {
|
|
145
|
-
return next(state, action);
|
|
146
|
-
}
|
|
147
|
-
return next(state, action).pipe(catchError((/**
|
|
148
|
-
* @param {?} error
|
|
149
|
-
* @return {?}
|
|
150
|
-
*/
|
|
151
|
-
error => {
|
|
152
|
-
/** @type {?} */
|
|
153
|
-
const newState = this.store.snapshot();
|
|
154
|
-
this.sendToDevTools(state, action, newState);
|
|
155
|
-
throw error;
|
|
156
|
-
})), tap((/**
|
|
157
|
-
* @param {?} newState
|
|
158
|
-
* @return {?}
|
|
159
|
-
*/
|
|
160
|
-
newState => {
|
|
161
|
-
this.sendToDevTools(state, action, newState);
|
|
162
|
-
})));
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* @private
|
|
166
|
-
* @param {?} state
|
|
167
|
-
* @param {?} action
|
|
168
|
-
* @param {?} newState
|
|
169
|
-
* @return {?}
|
|
170
|
-
*/
|
|
171
|
-
sendToDevTools(state, action, newState) {
|
|
172
|
-
/** @type {?} */
|
|
173
|
-
const type = getActionTypeFromInstance(action);
|
|
174
|
-
// if init action, send initial state to dev tools
|
|
175
|
-
/** @type {?} */
|
|
176
|
-
const isInitAction = type === '@@INIT';
|
|
177
|
-
if (isInitAction) {
|
|
178
|
-
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
(/** @type {?} */ (this.devtoolsExtension)).send(Object.assign({}, action, { action: null, type }), newState);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Handle the action from the dev tools subscription
|
|
186
|
-
* @param {?} action
|
|
187
|
-
* @return {?}
|
|
188
|
-
*/
|
|
189
|
-
dispatched(action) {
|
|
190
|
-
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
191
|
-
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
192
|
-
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
193
|
-
/** @type {?} */
|
|
194
|
-
const prevState = JSON.parse(action.state);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
* @
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
* @
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
* @
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
* @
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
82
|
+
/**
|
|
83
|
+
* @fileoverview added by tsickle
|
|
84
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
85
|
+
*/
|
|
86
|
+
/** @enum {string} */
|
|
87
|
+
const ReduxDevtoolsActionType = {
|
|
88
|
+
Dispatch: 'DISPATCH',
|
|
89
|
+
Action: 'ACTION',
|
|
90
|
+
};
|
|
91
|
+
/** @enum {string} */
|
|
92
|
+
const ReduxDevtoolsPayloadType = {
|
|
93
|
+
JumpToAction: 'JUMP_TO_ACTION',
|
|
94
|
+
JumpToState: 'JUMP_TO_STATE',
|
|
95
|
+
ToggleAction: 'TOGGLE_ACTION',
|
|
96
|
+
ImportState: 'IMPORT_STATE',
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Adds support for the Redux Devtools extension:
|
|
100
|
+
* http://extension.remotedev.io/
|
|
101
|
+
*/
|
|
102
|
+
class NgxsReduxDevtoolsPlugin {
|
|
103
|
+
/**
|
|
104
|
+
* @param {?} _options
|
|
105
|
+
* @param {?} _injector
|
|
106
|
+
* @param {?} _ngZone
|
|
107
|
+
*/
|
|
108
|
+
constructor(_options, _injector, _ngZone) {
|
|
109
|
+
this._options = _options;
|
|
110
|
+
this._injector = _injector;
|
|
111
|
+
this._ngZone = _ngZone;
|
|
112
|
+
this.devtoolsExtension = null;
|
|
113
|
+
this.globalDevtools = ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];
|
|
114
|
+
this.unsubscribe = null;
|
|
115
|
+
this.connect();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @return {?}
|
|
119
|
+
*/
|
|
120
|
+
ngOnDestroy() {
|
|
121
|
+
if (this.unsubscribe !== null) {
|
|
122
|
+
this.unsubscribe();
|
|
123
|
+
}
|
|
124
|
+
if (this.globalDevtools) {
|
|
125
|
+
this.globalDevtools.disconnect();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Lazy get the store for circular dependency issues
|
|
130
|
+
* @private
|
|
131
|
+
* @return {?}
|
|
132
|
+
*/
|
|
133
|
+
get store() {
|
|
134
|
+
return this._injector.get(Store);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Middleware handle function
|
|
138
|
+
* @param {?} state
|
|
139
|
+
* @param {?} action
|
|
140
|
+
* @param {?} next
|
|
141
|
+
* @return {?}
|
|
142
|
+
*/
|
|
143
|
+
handle(state, action, next) {
|
|
144
|
+
if (!this.devtoolsExtension || this._options.disabled) {
|
|
145
|
+
return next(state, action);
|
|
146
|
+
}
|
|
147
|
+
return next(state, action).pipe(catchError((/**
|
|
148
|
+
* @param {?} error
|
|
149
|
+
* @return {?}
|
|
150
|
+
*/
|
|
151
|
+
error => {
|
|
152
|
+
/** @type {?} */
|
|
153
|
+
const newState = this.store.snapshot();
|
|
154
|
+
this.sendToDevTools(state, action, newState);
|
|
155
|
+
throw error;
|
|
156
|
+
})), tap((/**
|
|
157
|
+
* @param {?} newState
|
|
158
|
+
* @return {?}
|
|
159
|
+
*/
|
|
160
|
+
newState => {
|
|
161
|
+
this.sendToDevTools(state, action, newState);
|
|
162
|
+
})));
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* @private
|
|
166
|
+
* @param {?} state
|
|
167
|
+
* @param {?} action
|
|
168
|
+
* @param {?} newState
|
|
169
|
+
* @return {?}
|
|
170
|
+
*/
|
|
171
|
+
sendToDevTools(state, action, newState) {
|
|
172
|
+
/** @type {?} */
|
|
173
|
+
const type = getActionTypeFromInstance(action);
|
|
174
|
+
// if init action, send initial state to dev tools
|
|
175
|
+
/** @type {?} */
|
|
176
|
+
const isInitAction = type === '@@INIT';
|
|
177
|
+
if (isInitAction) {
|
|
178
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(state);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
(/** @type {?} */ (this.devtoolsExtension)).send(Object.assign({}, action, { action: null, type }), newState);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Handle the action from the dev tools subscription
|
|
186
|
+
* @param {?} action
|
|
187
|
+
* @return {?}
|
|
188
|
+
*/
|
|
189
|
+
dispatched(action) {
|
|
190
|
+
if (action.type === "DISPATCH" /* Dispatch */) {
|
|
191
|
+
if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
|
|
192
|
+
action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
|
|
193
|
+
/** @type {?} */
|
|
194
|
+
const prevState = JSON.parse(action.state);
|
|
195
|
+
// This makes the DevTools and Router plugins friends with each other.
|
|
196
|
+
// We're checking for the `router` state to exist, and it also should
|
|
197
|
+
// have the `trigger` property, so we're sure that this is our router
|
|
198
|
+
// state (coming from `@ngxs/router-plugin`). This enables a time-traveling
|
|
199
|
+
// feature since it doesn't only restore the state but also allows the `RouterState`
|
|
200
|
+
// to navigate back when the action is jumped.
|
|
201
|
+
if (prevState.router && prevState.router.trigger) {
|
|
202
|
+
prevState.router.trigger = 'devtools';
|
|
203
|
+
}
|
|
204
|
+
this.store.reset(prevState);
|
|
205
|
+
}
|
|
206
|
+
else if (action.payload.type === "TOGGLE_ACTION" /* ToggleAction */) {
|
|
207
|
+
console.warn('Skip is not supported at this time.');
|
|
208
|
+
}
|
|
209
|
+
else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
|
|
210
|
+
const { actionsById, computedStates, currentStateIndex } = action.payload.nextLiftedState;
|
|
211
|
+
(/** @type {?} */ (this.devtoolsExtension)).init(computedStates[0].state);
|
|
212
|
+
Object.keys(actionsById)
|
|
213
|
+
.filter((/**
|
|
214
|
+
* @param {?} actionId
|
|
215
|
+
* @return {?}
|
|
216
|
+
*/
|
|
217
|
+
actionId => actionId !== '0'))
|
|
218
|
+
.forEach((/**
|
|
219
|
+
* @param {?} actionId
|
|
220
|
+
* @return {?}
|
|
221
|
+
*/
|
|
222
|
+
actionId => (/** @type {?} */ (this.devtoolsExtension)).send(actionsById[actionId], computedStates[actionId].state)));
|
|
223
|
+
this.store.reset(computedStates[currentStateIndex].state);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else if (action.type === "ACTION" /* Action */) {
|
|
227
|
+
/** @type {?} */
|
|
228
|
+
const actionPayload = JSON.parse(action.payload);
|
|
229
|
+
this.store.dispatch(actionPayload);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @private
|
|
234
|
+
* @return {?}
|
|
235
|
+
*/
|
|
236
|
+
connect() {
|
|
237
|
+
if (!this.globalDevtools || this._options.disabled) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
// The `connect` method adds `message` event listener since it communicates
|
|
241
|
+
// with an extension through `window.postMessage` and message events.
|
|
242
|
+
// We handle only 2 events; thus, we don't want to run many change detections
|
|
243
|
+
// because the extension sends events that we don't have to handle.
|
|
244
|
+
this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
|
|
245
|
+
* @return {?}
|
|
246
|
+
*/
|
|
247
|
+
() => (/** @type {?} */ (this.globalDevtools.connect(this._options)))));
|
|
248
|
+
this.unsubscribe = this.devtoolsExtension.subscribe((/**
|
|
249
|
+
* @param {?} action
|
|
250
|
+
* @return {?}
|
|
251
|
+
*/
|
|
252
|
+
action => {
|
|
253
|
+
if (action.type === "DISPATCH" /* Dispatch */ ||
|
|
254
|
+
action.type === "ACTION" /* Action */) {
|
|
255
|
+
this._ngZone.run((/**
|
|
256
|
+
* @return {?}
|
|
257
|
+
*/
|
|
258
|
+
() => {
|
|
259
|
+
this.dispatched(action);
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
}));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
NgxsReduxDevtoolsPlugin.decorators = [
|
|
266
|
+
{ type: Injectable }
|
|
267
|
+
];
|
|
268
|
+
/** @nocollapse */
|
|
269
|
+
NgxsReduxDevtoolsPlugin.ctorParameters = () => [
|
|
270
|
+
{ type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
|
|
271
|
+
{ type: Injector },
|
|
272
|
+
{ type: NgZone }
|
|
273
|
+
];
|
|
274
|
+
if (false) {
|
|
275
|
+
/**
|
|
276
|
+
* @type {?}
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
279
|
+
NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
|
|
280
|
+
/**
|
|
281
|
+
* @type {?}
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
|
|
285
|
+
/**
|
|
286
|
+
* @type {?}
|
|
287
|
+
* @private
|
|
288
|
+
*/
|
|
289
|
+
NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
|
|
290
|
+
/**
|
|
291
|
+
* @type {?}
|
|
292
|
+
* @private
|
|
293
|
+
*/
|
|
294
|
+
NgxsReduxDevtoolsPlugin.prototype._options;
|
|
295
|
+
/**
|
|
296
|
+
* @type {?}
|
|
297
|
+
* @private
|
|
298
|
+
*/
|
|
299
|
+
NgxsReduxDevtoolsPlugin.prototype._injector;
|
|
300
|
+
/**
|
|
301
|
+
* @type {?}
|
|
302
|
+
* @private
|
|
303
|
+
*/
|
|
304
|
+
NgxsReduxDevtoolsPlugin.prototype._ngZone;
|
|
296
305
|
}
|
|
297
306
|
|
|
298
|
-
/**
|
|
299
|
-
* @fileoverview added by tsickle
|
|
300
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
301
|
-
*/
|
|
302
|
-
/**
|
|
303
|
-
* @param {?} options
|
|
304
|
-
* @return {?}
|
|
305
|
-
*/
|
|
306
|
-
function devtoolsOptionsFactory(options) {
|
|
307
|
-
return Object.assign({ name: 'NGXS' }, options);
|
|
308
|
-
}
|
|
309
|
-
/** @type {?} */
|
|
310
|
-
const USER_OPTIONS = new InjectionToken('USER_OPTIONS');
|
|
311
|
-
class NgxsReduxDevtoolsPluginModule {
|
|
312
|
-
/**
|
|
313
|
-
* @param {?=} options
|
|
314
|
-
* @return {?}
|
|
315
|
-
*/
|
|
316
|
-
static forRoot(options) {
|
|
317
|
-
return {
|
|
318
|
-
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
319
|
-
providers: [
|
|
320
|
-
{
|
|
321
|
-
provide: NGXS_PLUGINS,
|
|
322
|
-
useClass: NgxsReduxDevtoolsPlugin,
|
|
323
|
-
multi: true
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
provide: USER_OPTIONS,
|
|
327
|
-
useValue: options
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
331
|
-
useFactory: devtoolsOptionsFactory,
|
|
332
|
-
deps: [USER_OPTIONS]
|
|
333
|
-
}
|
|
334
|
-
]
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
339
|
-
{ type: NgModule }
|
|
307
|
+
/**
|
|
308
|
+
* @fileoverview added by tsickle
|
|
309
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
310
|
+
*/
|
|
311
|
+
/**
|
|
312
|
+
* @param {?} options
|
|
313
|
+
* @return {?}
|
|
314
|
+
*/
|
|
315
|
+
function devtoolsOptionsFactory(options) {
|
|
316
|
+
return Object.assign({ name: 'NGXS' }, options);
|
|
317
|
+
}
|
|
318
|
+
/** @type {?} */
|
|
319
|
+
const USER_OPTIONS = new InjectionToken('USER_OPTIONS');
|
|
320
|
+
class NgxsReduxDevtoolsPluginModule {
|
|
321
|
+
/**
|
|
322
|
+
* @param {?=} options
|
|
323
|
+
* @return {?}
|
|
324
|
+
*/
|
|
325
|
+
static forRoot(options) {
|
|
326
|
+
return {
|
|
327
|
+
ngModule: NgxsReduxDevtoolsPluginModule,
|
|
328
|
+
providers: [
|
|
329
|
+
{
|
|
330
|
+
provide: NGXS_PLUGINS,
|
|
331
|
+
useClass: NgxsReduxDevtoolsPlugin,
|
|
332
|
+
multi: true
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
provide: USER_OPTIONS,
|
|
336
|
+
useValue: options
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
provide: NGXS_DEVTOOLS_OPTIONS,
|
|
340
|
+
useFactory: devtoolsOptionsFactory,
|
|
341
|
+
deps: [USER_OPTIONS]
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
NgxsReduxDevtoolsPluginModule.decorators = [
|
|
348
|
+
{ type: NgModule }
|
|
340
349
|
];
|
|
341
350
|
|
|
342
|
-
/**
|
|
343
|
-
* @fileoverview added by tsickle
|
|
344
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
351
|
+
/**
|
|
352
|
+
* @fileoverview added by tsickle
|
|
353
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
345
354
|
*/
|
|
346
355
|
|
|
347
|
-
/**
|
|
348
|
-
* @fileoverview added by tsickle
|
|
349
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
356
|
+
/**
|
|
357
|
+
* @fileoverview added by tsickle
|
|
358
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
350
359
|
*/
|
|
351
360
|
|
|
352
|
-
/**
|
|
353
|
-
* @fileoverview added by tsickle
|
|
354
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
361
|
+
/**
|
|
362
|
+
* @fileoverview added by tsickle
|
|
363
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
355
364
|
*/
|
|
356
365
|
|
|
357
366
|
export { NGXS_DEVTOOLS_OPTIONS, NgxsReduxDevtoolsPlugin, NgxsReduxDevtoolsPluginModule, devtoolsOptionsFactory as ɵa, USER_OPTIONS as ɵb };
|