@ngxs/store 3.7.3-dev.master-d470dff → 3.7.3-dev.master-69553aa
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/bundles/ngxs-store-internals.umd.js +67 -97
- package/bundles/ngxs-store-internals.umd.js.map +1 -1
- package/bundles/ngxs-store-internals.umd.min.js +1 -1
- package/bundles/ngxs-store-internals.umd.min.js.map +1 -1
- package/bundles/ngxs-store.umd.js +94 -59
- package/bundles/ngxs-store.umd.js.map +1 -1
- package/bundles/ngxs-store.umd.min.js +1 -1
- package/bundles/ngxs-store.umd.min.js.map +1 -1
- package/esm2015/internals/angular.js +7 -38
- package/esm2015/ngxs-store.js +12 -13
- package/esm2015/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +4 -2
- package/esm2015/src/execution/noop-ngxs-execution-strategy.js +4 -2
- package/esm2015/src/execution/symbols.js +26 -3
- package/esm2015/src/internal/state-stream.js +10 -1
- package/esm2015/src/module.js +4 -5
- package/esm5/internals/angular.js +7 -38
- package/esm5/ngxs-store.js +12 -13
- package/esm5/src/execution/dispatch-outside-zone-ngxs-execution-strategy.js +4 -2
- package/esm5/src/execution/noop-ngxs-execution-strategy.js +4 -2
- package/esm5/src/execution/symbols.js +26 -3
- package/esm5/src/internal/state-stream.js +13 -1
- package/esm5/src/module.js +4 -5
- package/fesm2015/ngxs-store-internals.js +54 -84
- package/fesm2015/ngxs-store-internals.js.map +1 -1
- package/fesm2015/ngxs-store.js +64 -32
- package/fesm2015/ngxs-store.js.map +1 -1
- package/fesm5/ngxs-store-internals.js +68 -98
- package/fesm5/ngxs-store-internals.js.map +1 -1
- package/fesm5/ngxs-store.js +80 -45
- package/fesm5/ngxs-store.js.map +1 -1
- package/internals/angular.d.ts +1 -3
- package/internals/ngxs-store-internals.metadata.json +1 -1
- package/ngxs-store.d.ts +11 -12
- package/ngxs-store.metadata.json +1 -1
- package/package.json +1 -1
- package/src/execution/symbols.d.ts +5 -1
- package/src/internal/state-stream.d.ts +3 -1
|
@@ -1,6 +1,73 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ɵglobal, Injectable, InjectionToken, ɵɵdirectiveInject, INJECTOR } from '@angular/core';
|
|
2
2
|
import { ReplaySubject } from 'rxjs';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview added by tsickle
|
|
6
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @return {?}
|
|
10
|
+
*/
|
|
11
|
+
function isAngularInTestMode() {
|
|
12
|
+
return (typeof ɵglobal.__karma__ !== 'undefined' ||
|
|
13
|
+
typeof ɵglobal.jasmine !== 'undefined' ||
|
|
14
|
+
typeof ɵglobal.jest !== 'undefined' ||
|
|
15
|
+
typeof ɵglobal.Mocha !== 'undefined');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @fileoverview added by tsickle
|
|
20
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
21
|
+
*/
|
|
22
|
+
var NgxsBootstrapper = /** @class */ (function () {
|
|
23
|
+
function NgxsBootstrapper() {
|
|
24
|
+
/**
|
|
25
|
+
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
26
|
+
*/
|
|
27
|
+
this.bootstrap$ = new ReplaySubject(1);
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(NgxsBootstrapper.prototype, "appBootstrapped$", {
|
|
30
|
+
get: /**
|
|
31
|
+
* @return {?}
|
|
32
|
+
*/
|
|
33
|
+
function () {
|
|
34
|
+
return this.bootstrap$.asObservable();
|
|
35
|
+
},
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
41
|
+
* to the tree of views, that's a signal that application has been fully rendered
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
45
|
+
* to the tree of views, that's a signal that application has been fully rendered
|
|
46
|
+
* @return {?}
|
|
47
|
+
*/
|
|
48
|
+
NgxsBootstrapper.prototype.bootstrap = /**
|
|
49
|
+
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
50
|
+
* to the tree of views, that's a signal that application has been fully rendered
|
|
51
|
+
* @return {?}
|
|
52
|
+
*/
|
|
53
|
+
function () {
|
|
54
|
+
this.bootstrap$.next(true);
|
|
55
|
+
this.bootstrap$.complete();
|
|
56
|
+
};
|
|
57
|
+
NgxsBootstrapper.decorators = [
|
|
58
|
+
{ type: Injectable }
|
|
59
|
+
];
|
|
60
|
+
return NgxsBootstrapper;
|
|
61
|
+
}());
|
|
62
|
+
if (false) {
|
|
63
|
+
/**
|
|
64
|
+
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
65
|
+
* @type {?}
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
NgxsBootstrapper.prototype.bootstrap$;
|
|
69
|
+
}
|
|
70
|
+
|
|
4
71
|
/**
|
|
5
72
|
* @fileoverview added by tsickle
|
|
6
73
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -72,103 +139,6 @@ function memoize(func, equalityCheck) {
|
|
|
72
139
|
return (/** @type {?} */ (memoized));
|
|
73
140
|
}
|
|
74
141
|
|
|
75
|
-
/**
|
|
76
|
-
* @fileoverview added by tsickle
|
|
77
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
78
|
-
*/
|
|
79
|
-
/**
|
|
80
|
-
* @return {?}
|
|
81
|
-
*/
|
|
82
|
-
function _isAngularInTestMode() {
|
|
83
|
-
/** @type {?} */
|
|
84
|
-
var platformRef = getPlatform();
|
|
85
|
-
if (!platformRef)
|
|
86
|
-
return false;
|
|
87
|
-
/** @type {?} */
|
|
88
|
-
var compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);
|
|
89
|
-
if (!compilerOptions)
|
|
90
|
-
return false;
|
|
91
|
-
/** @type {?} */
|
|
92
|
-
var isInTestMode = compilerOptions.some((/**
|
|
93
|
-
* @param {?} item
|
|
94
|
-
* @return {?}
|
|
95
|
-
*/
|
|
96
|
-
function (item) {
|
|
97
|
-
/** @type {?} */
|
|
98
|
-
var providers = (item && item.providers) || [];
|
|
99
|
-
return providers.some((/**
|
|
100
|
-
* @param {?} provider
|
|
101
|
-
* @return {?}
|
|
102
|
-
*/
|
|
103
|
-
function (provider) {
|
|
104
|
-
return ((provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||
|
|
105
|
-
false);
|
|
106
|
-
}));
|
|
107
|
-
}));
|
|
108
|
-
return isInTestMode;
|
|
109
|
-
}
|
|
110
|
-
/** @type {?} */
|
|
111
|
-
var isAngularInTestMode =
|
|
112
|
-
// Caretaker note: we have still left the `typeof` condition in order to avoid
|
|
113
|
-
// creating a breaking change for projects that still use the View Engine.
|
|
114
|
-
typeof ngDevMode === 'undefined' || ngDevMode ? memoize(_isAngularInTestMode) : (/**
|
|
115
|
-
* @return {?}
|
|
116
|
-
*/
|
|
117
|
-
function () { return false; });
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @fileoverview added by tsickle
|
|
121
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
122
|
-
*/
|
|
123
|
-
var NgxsBootstrapper = /** @class */ (function () {
|
|
124
|
-
function NgxsBootstrapper() {
|
|
125
|
-
/**
|
|
126
|
-
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
127
|
-
*/
|
|
128
|
-
this.bootstrap$ = new ReplaySubject(1);
|
|
129
|
-
}
|
|
130
|
-
Object.defineProperty(NgxsBootstrapper.prototype, "appBootstrapped$", {
|
|
131
|
-
get: /**
|
|
132
|
-
* @return {?}
|
|
133
|
-
*/
|
|
134
|
-
function () {
|
|
135
|
-
return this.bootstrap$.asObservable();
|
|
136
|
-
},
|
|
137
|
-
enumerable: true,
|
|
138
|
-
configurable: true
|
|
139
|
-
});
|
|
140
|
-
/**
|
|
141
|
-
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
142
|
-
* to the tree of views, that's a signal that application has been fully rendered
|
|
143
|
-
*/
|
|
144
|
-
/**
|
|
145
|
-
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
146
|
-
* to the tree of views, that's a signal that application has been fully rendered
|
|
147
|
-
* @return {?}
|
|
148
|
-
*/
|
|
149
|
-
NgxsBootstrapper.prototype.bootstrap = /**
|
|
150
|
-
* This event will be emitted after attaching `ComponentRef` of the root component
|
|
151
|
-
* to the tree of views, that's a signal that application has been fully rendered
|
|
152
|
-
* @return {?}
|
|
153
|
-
*/
|
|
154
|
-
function () {
|
|
155
|
-
this.bootstrap$.next(true);
|
|
156
|
-
this.bootstrap$.complete();
|
|
157
|
-
};
|
|
158
|
-
NgxsBootstrapper.decorators = [
|
|
159
|
-
{ type: Injectable }
|
|
160
|
-
];
|
|
161
|
-
return NgxsBootstrapper;
|
|
162
|
-
}());
|
|
163
|
-
if (false) {
|
|
164
|
-
/**
|
|
165
|
-
* Use `ReplaySubject`, thus we can get cached value even if the stream is completed
|
|
166
|
-
* @type {?}
|
|
167
|
-
* @private
|
|
168
|
-
*/
|
|
169
|
-
NgxsBootstrapper.prototype.bootstrap$;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
142
|
/**
|
|
173
143
|
* @fileoverview added by tsickle
|
|
174
144
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts","ng://@ngxs/store/internals/decorator-injector-adapter.ts"],"sourcesContent":["function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = (<Function>func).apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { getPlatform, COMPILER_OPTIONS, CompilerOptions, PlatformRef } from '@angular/core';\nimport { memoize } from './memoize';\n\n/**\n * @description Will be provided through Terser global definitions by Angular CLI\n * during the production build. This is how Angular does tree-shaking internally.\n */\ndeclare const ngDevMode: boolean;\n\nfunction _isAngularInTestMode(): boolean {\n const platformRef: PlatformRef | null = getPlatform();\n if (!platformRef) return false;\n const compilerOptions = platformRef.injector.get(COMPILER_OPTIONS, null);\n if (!compilerOptions) return false;\n const isInTestMode = compilerOptions.some((item: CompilerOptions) => {\n const providers = (item && item.providers) || [];\n return providers.some((provider: any) => {\n return (\n (provider && provider.provide && provider.provide.name === 'MockNgModuleResolver') ||\n false\n );\n });\n });\n return isInTestMode;\n}\n\nexport const isAngularInTestMode =\n // Caretaker note: we have still left the `typeof` condition in order to avoid\n // creating a breaking change for projects that still use the View Engine.\n typeof ngDevMode === 'undefined' || ngDevMode ? memoize(_isAngularInTestMode) : () => false;\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateContextFactory'\n);\n\n/**\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateFactory'\n);\n","import {\n InjectionToken,\n Injector,\n INJECTOR,\n Type,\n ɵɵdirectiveInject,\n ɵglobal\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\n// Will be provided through Terser global definitions by Angular CLI\n// during the production build. This is how Angular does tree-shaking internally.\ndeclare const ngDevMode: boolean;\n\n// Angular doesn't export `NG_FACTORY_DEF`.\nconst NG_FACTORY_DEF = 'ɵfac';\n\n// A `Symbol` which is used to save the `Injector` onto the class instance.\nconst InjectorInstance: unique symbol = Symbol('InjectorInstance');\n\n// A `Symbol` which is used to determine if factory has been decorated previously or not.\nconst FactoryHasBeenDecorated: unique symbol = Symbol('FactoryHasBeenDecorated');\n\n// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot\n// be retrieved within the `constructor` since it's set after the `factory()` is called.\nconst InjectorNotifier: unique symbol = Symbol('InjectorNotifier');\n\ninterface PrototypeWithInjectorNotifier extends Object {\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n\nexport function ensureInjectorNotifierIsCaptured(\n target: PrototypeWithInjectorNotifier | PrivateInstance\n): ReplaySubject<boolean> {\n if (target[InjectorNotifier]) {\n return target[InjectorNotifier]!;\n } else {\n const injectorNotifier$ = new ReplaySubject<boolean>(1);\n Object.defineProperty(target, InjectorNotifier, {\n get: () => injectorNotifier$\n });\n return injectorNotifier$;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function ensureLocalInjectorCaptured(target: Object): void {\n if (FactoryHasBeenDecorated in target.constructor.prototype) {\n return;\n }\n\n const constructor: ConstructorWithDefinitionAndFactory = target.constructor;\n // Means we're in AOT mode.\n if (typeof constructor[NG_FACTORY_DEF] === 'function') {\n decorateFactory(constructor);\n } else if (ngDevMode) {\n // We're running in JIT mode and that means we're not able to get the compiled definition\n // on the class inside the property decorator during the current message loop tick. We have\n // to wait for the next message loop tick. Note that this is safe since this Promise will be\n // resolved even before the `APP_INITIALIZER` is resolved.\n // The below code also will be executed only in development mode, since it's never recommended\n // to use the JIT compiler in production mode (by setting \"aot: false\").\n decorateFactoryLater(constructor);\n }\n\n target.constructor.prototype[FactoryHasBeenDecorated] = true;\n}\n\nexport function localInject<T>(\n instance: PrivateInstance,\n token: InjectionToken<T> | Type<T>\n): T | null {\n const injector: Injector | undefined = instance[InjectorInstance];\n return injector ? injector.get(token) : null;\n}\n\nfunction decorateFactory(constructor: ConstructorWithDefinitionAndFactory): void {\n const factory = constructor[NG_FACTORY_DEF];\n\n if (typeof factory !== 'function') {\n return;\n }\n\n // Let's try to get any definition.\n // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first\n // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).\n const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;\n\n const decoratedFactory = () => {\n const instance = factory();\n // Caretaker note: `inject()` won't work here.\n // We can use the `directiveInject` only during the component\n // construction, since Angular captures the currently active injector.\n // We're not able to use this function inside the getter (when the `selectorId` property is\n // requested for the first time), since the currently active injector will be null.\n instance[InjectorInstance] = ɵɵdirectiveInject(\n // We're using `INJECTOR` token except of the `Injector` class since the compiler\n // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.\n // Caretaker note: that this is the same way of getting the injector.\n INJECTOR\n );\n\n // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.\n const injectorNotifier$ = instance[InjectorNotifier];\n if (injectorNotifier$) {\n injectorNotifier$.next(true);\n injectorNotifier$.complete();\n }\n\n return instance;\n };\n\n // If we've found any definition then it's enough to override the `def.factory` since Angular\n // code uses the `def.factory` and then fallbacks to `ɵfac`.\n if (def) {\n def.factory = decoratedFactory;\n }\n\n // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular\n // still uses the `ɵfac`.\n Object.defineProperty(constructor, NG_FACTORY_DEF, {\n get: () => decoratedFactory\n });\n}\n\nfunction decorateFactoryLater(constructor: ConstructorWithDefinitionAndFactory): void {\n // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.\n // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws\n // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call\n // Promise.then from within a sync test`.\n try {\n Promise.resolve().then(() => {\n decorateFactory(constructor);\n });\n } catch {\n // This is kind of a \"hack\", but we try to be backwards-compatible,\n // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.\n ɵglobal.process &&\n ɵglobal.process.nextTick &&\n ɵglobal.process.nextTick(() => {\n decorateFactory(constructor);\n });\n }\n}\n\n// We could've used `ɵɵFactoryDef` but we try to be backwards-compatible,\n// since it's not exported in older Angular versions.\ntype Factory = () => PrivateInstance;\n\n// We could've used `ɵɵInjectableDef`, `ɵɵPipeDef`, etc. We try to be backwards-compatible\n// since they're not exported in older Angular versions.\ninterface Definition {\n factory: Factory | null;\n}\n\ninterface ConstructorWithDefinitionAndFactory extends Function {\n // Provider definition for the `@Injectable()` class.\n ɵprov?: Definition;\n // Pipe definition for the `@Pipe()` class.\n ɵpipe?: Definition;\n // Component definition for the `@Component()` class.\n ɵcmp?: Definition;\n // Directive definition for the `@Directive()` class.\n ɵdir?: Definition;\n [NG_FACTORY_DEF]?: Factory;\n}\n\ninterface PrivateInstance {\n [InjectorInstance]?: Injector;\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;IAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;CAChB;;;;;;;AAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;IAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;QACjE,OAAO,KAAK,CAAC;KACd;;;QAGK,MAAM,GAAG,IAAI,CAAC,MAAM;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;YACpC,OAAO,KAAK,CAAC;SACd;KACF;IAED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pF,gBAAgB;;;IAAG;;YACjB,QAAQ,GAAG,OAAO,EAAE;;;;;;QAM1B,QAAQ,CAAC,gBAAgB,CAAC,GAAG,iBAAiB;;;;QAI5C,QAAQ,CACT,CAAC;;;YAGI,iBAAiB,GAAG,QAAQ,CAAC,gBAAgB,CAAC;QACpD,IAAI,iBAAiB,EAAE;YACrB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7B,iBAAiB,CAAC,QAAQ,EAAE,CAAC;SAC9B;QAED,OAAO,QAAQ,CAAC;KACjB,CAAA;;;IAID,IAAI,GAAG,EAAE;QACP,GAAG,CAAC,OAAO,GAAG,gBAAgB,CAAC;KAChC;;;IAID,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,EAAE;QACjD,GAAG;;;QAAE,cAAM,OAAA,gBAAgB,GAAA,CAAA;KAC5B,CAAC,CAAC;CACJ;;;;;AAED,SAAS,oBAAoB,CAAC,WAAgD;;;;;IAK5E,IAAI;QACF,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI;;;QAAC;YACrB,eAAe,CAAC,WAAW,CAAC,CAAC;SAC9B,EAAC,CAAC;KACJ;IAAC,WAAM;;;QAGN,OAAO,CAAC,OAAO;YACb,OAAO,CAAC,OAAO,CAAC,QAAQ;YACxB,OAAO,CAAC,OAAO,CAAC,QAAQ;;;YAAC;gBACvB,eAAe,CAAC,WAAW,CAAC,CAAC;aAC9B,EAAC,CAAC;KACN;CACF;;;;AAQD,yBAEC;;;IADC,6BAAwB;;;;;AAG1B,kDAUC;;;IARC,oDAAmB;;IAEnB,oDAAmB;;IAEnB,mDAAkB;;IAElB,mDAAkB;;;;;;;AAIpB,8BAGC;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ngxs-store-internals.js","sources":["ng://@ngxs/store/internals/angular.ts","ng://@ngxs/store/internals/ngxs-bootstrapper.ts","ng://@ngxs/store/internals/memoize.ts","ng://@ngxs/store/internals/initial-state.ts","ng://@ngxs/store/internals/internal-tokens.ts","ng://@ngxs/store/internals/decorator-injector-adapter.ts"],"sourcesContent":["import { ɵglobal } from '@angular/core';\n\nexport function isAngularInTestMode(): boolean {\n return (\n typeof ɵglobal.__karma__ !== 'undefined' ||\n typeof ɵglobal.jasmine !== 'undefined' ||\n typeof ɵglobal.jest !== 'undefined' ||\n typeof ɵglobal.Mocha !== 'undefined'\n );\n}\n","import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject } from 'rxjs';\n\n@Injectable()\nexport class NgxsBootstrapper {\n /**\n * Use `ReplaySubject`, thus we can get cached value even if the stream is completed\n */\n private bootstrap$ = new ReplaySubject<boolean>(1);\n\n get appBootstrapped$(): Observable<boolean> {\n return this.bootstrap$.asObservable();\n }\n\n /**\n * This event will be emitted after attaching `ComponentRef` of the root component\n * to the tree of views, that's a signal that application has been fully rendered\n */\n bootstrap(): void {\n this.bootstrap$.next(true);\n this.bootstrap$.complete();\n }\n}\n","function defaultEqualityCheck(a: any, b: any) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(\n equalityCheck: (a: any, b: any) => boolean,\n prev: IArguments | null,\n next: IArguments | null\n) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n const length = prev.length;\n for (let i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Memoize a function on its last inputs only.\n * Originally from: https://github.com/reduxjs/reselect/blob/master/src/index.js\n *\n * @ignore\n */\nexport function memoize<T extends (...args: any[]) => any>(\n func: T,\n equalityCheck = defaultEqualityCheck\n): T {\n let lastArgs: IArguments | null = null;\n let lastResult: any = null;\n // we reference arguments instead of spreading them for performance reasons\n function memoized() {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = (<Function>func).apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n }\n (<any>memoized).reset = function() {\n // The hidden (for now) ability to reset the memoization\n lastArgs = null;\n lastResult = null;\n };\n return memoized as T;\n}\n","import { InjectionToken } from '@angular/core';\nimport { PlainObject } from './symbols';\n\nexport const INITIAL_STATE_TOKEN = new InjectionToken<any>('INITIAL_STATE_TOKEN');\n\nexport class InitialState {\n private static value: PlainObject = {};\n\n public static set(state: PlainObject) {\n this.value = state;\n }\n\n public static pop(): PlainObject {\n const state: PlainObject = this.value;\n this.value = {};\n return state;\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * @see StateContextFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_CONTEXT_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateContextFactory'\n);\n\n/**\n * @see StateFactory as it's referenced by this token to be accessed by plugins internally\n */\nexport const NGXS_STATE_FACTORY: InjectionToken<any> = new InjectionToken(\n 'Internals.StateFactory'\n);\n","import {\n InjectionToken,\n Injector,\n INJECTOR,\n Type,\n ɵɵdirectiveInject,\n ɵglobal\n} from '@angular/core';\nimport { ReplaySubject } from 'rxjs';\n\n// Will be provided through Terser global definitions by Angular CLI\n// during the production build. This is how Angular does tree-shaking internally.\ndeclare const ngDevMode: boolean;\n\n// Angular doesn't export `NG_FACTORY_DEF`.\nconst NG_FACTORY_DEF = 'ɵfac';\n\n// A `Symbol` which is used to save the `Injector` onto the class instance.\nconst InjectorInstance: unique symbol = Symbol('InjectorInstance');\n\n// A `Symbol` which is used to determine if factory has been decorated previously or not.\nconst FactoryHasBeenDecorated: unique symbol = Symbol('FactoryHasBeenDecorated');\n\n// A `Symbol` which is used to save the notifier on the class instance. The `InjectorInstance` cannot\n// be retrieved within the `constructor` since it's set after the `factory()` is called.\nconst InjectorNotifier: unique symbol = Symbol('InjectorNotifier');\n\ninterface PrototypeWithInjectorNotifier extends Object {\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n\nexport function ensureInjectorNotifierIsCaptured(\n target: PrototypeWithInjectorNotifier | PrivateInstance\n): ReplaySubject<boolean> {\n if (target[InjectorNotifier]) {\n return target[InjectorNotifier]!;\n } else {\n const injectorNotifier$ = new ReplaySubject<boolean>(1);\n Object.defineProperty(target, InjectorNotifier, {\n get: () => injectorNotifier$\n });\n return injectorNotifier$;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function ensureLocalInjectorCaptured(target: Object): void {\n if (FactoryHasBeenDecorated in target.constructor.prototype) {\n return;\n }\n\n const constructor: ConstructorWithDefinitionAndFactory = target.constructor;\n // Means we're in AOT mode.\n if (typeof constructor[NG_FACTORY_DEF] === 'function') {\n decorateFactory(constructor);\n } else if (ngDevMode) {\n // We're running in JIT mode and that means we're not able to get the compiled definition\n // on the class inside the property decorator during the current message loop tick. We have\n // to wait for the next message loop tick. Note that this is safe since this Promise will be\n // resolved even before the `APP_INITIALIZER` is resolved.\n // The below code also will be executed only in development mode, since it's never recommended\n // to use the JIT compiler in production mode (by setting \"aot: false\").\n decorateFactoryLater(constructor);\n }\n\n target.constructor.prototype[FactoryHasBeenDecorated] = true;\n}\n\nexport function localInject<T>(\n instance: PrivateInstance,\n token: InjectionToken<T> | Type<T>\n): T | null {\n const injector: Injector | undefined = instance[InjectorInstance];\n return injector ? injector.get(token) : null;\n}\n\nfunction decorateFactory(constructor: ConstructorWithDefinitionAndFactory): void {\n const factory = constructor[NG_FACTORY_DEF];\n\n if (typeof factory !== 'function') {\n return;\n }\n\n // Let's try to get any definition.\n // Caretaker note: this will be compatible only with Angular 9+, since Angular 9 is the first\n // Ivy-stable version. Previously definition properties were named differently (e.g. `ngComponentDef`).\n const def = constructor.ɵprov || constructor.ɵpipe || constructor.ɵcmp || constructor.ɵdir;\n\n const decoratedFactory = () => {\n const instance = factory();\n // Caretaker note: `inject()` won't work here.\n // We can use the `directiveInject` only during the component\n // construction, since Angular captures the currently active injector.\n // We're not able to use this function inside the getter (when the `selectorId` property is\n // requested for the first time), since the currently active injector will be null.\n instance[InjectorInstance] = ɵɵdirectiveInject(\n // We're using `INJECTOR` token except of the `Injector` class since the compiler\n // throws: `Cannot assign an abstract constructor type to a non-abstract constructor type.`.\n // Caretaker note: that this is the same way of getting the injector.\n INJECTOR\n );\n\n // Caretaker note: the notifier will be available only if consumers call the `ensureInjectorNotifierIsCaptured()`.\n const injectorNotifier$ = instance[InjectorNotifier];\n if (injectorNotifier$) {\n injectorNotifier$.next(true);\n injectorNotifier$.complete();\n }\n\n return instance;\n };\n\n // If we've found any definition then it's enough to override the `def.factory` since Angular\n // code uses the `def.factory` and then fallbacks to `ɵfac`.\n if (def) {\n def.factory = decoratedFactory;\n }\n\n // `@NgModule()` doesn't doesn't have definition factory, also providers have definitions but Angular\n // still uses the `ɵfac`.\n Object.defineProperty(constructor, NG_FACTORY_DEF, {\n get: () => decoratedFactory\n });\n}\n\nfunction decorateFactoryLater(constructor: ConstructorWithDefinitionAndFactory): void {\n // This function actually will be tree-shaken away when building for production since it's guarded with `ngDevMode`.\n // We're having the `try-catch` here because of the `SyncTestZoneSpec`, which throws\n // an error when micro or macrotask is used within a synchronous test. E.g. `Cannot call\n // Promise.then from within a sync test`.\n try {\n Promise.resolve().then(() => {\n decorateFactory(constructor);\n });\n } catch {\n // This is kind of a \"hack\", but we try to be backwards-compatible,\n // tho this `catch` block will only be executed when tests are run with Jasmine or Jest.\n ɵglobal.process &&\n ɵglobal.process.nextTick &&\n ɵglobal.process.nextTick(() => {\n decorateFactory(constructor);\n });\n }\n}\n\n// We could've used `ɵɵFactoryDef` but we try to be backwards-compatible,\n// since it's not exported in older Angular versions.\ntype Factory = () => PrivateInstance;\n\n// We could've used `ɵɵInjectableDef`, `ɵɵPipeDef`, etc. We try to be backwards-compatible\n// since they're not exported in older Angular versions.\ninterface Definition {\n factory: Factory | null;\n}\n\ninterface ConstructorWithDefinitionAndFactory extends Function {\n // Provider definition for the `@Injectable()` class.\n ɵprov?: Definition;\n // Pipe definition for the `@Pipe()` class.\n ɵpipe?: Definition;\n // Component definition for the `@Component()` class.\n ɵcmp?: Definition;\n // Directive definition for the `@Directive()` class.\n ɵdir?: Definition;\n [NG_FACTORY_DEF]?: Factory;\n}\n\ninterface PrivateInstance {\n [InjectorInstance]?: Injector;\n [InjectorNotifier]?: ReplaySubject<boolean>;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;AAEA,SAAgB,mBAAmB;IACjC,QACE,OAAO,OAAO,CAAC,SAAS,KAAK,WAAW;QACxC,OAAO,OAAO,CAAC,OAAO,KAAK,WAAW;QACtC,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW;QACnC,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW,EACpC;CACH;;;;;;ACTD;IAGA;;;;QAKU,eAAU,GAAG,IAAI,aAAa,CAAU,CAAC,CAAC,CAAC;KAcpD;IAZC,sBAAI,8CAAgB;;;;QAApB;YACE,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;SACvC;;;OAAA;;;;;;;;;;IAMD,oCAAS;;;;;IAAT;QACE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC5B;;gBAlBF,UAAU;;IAmBX,uBAAC;CAnBD,IAmBC;;;;;;;IAdC,sCAAmD;;;;;;;;;;;;ACRrD,SAAS,oBAAoB,CAAC,CAAM,EAAE,CAAM;IAC1C,OAAO,CAAC,KAAK,CAAC,CAAC;CAChB;;;;;;;AAED,SAAS,0BAA0B,CACjC,aAA0C,EAC1C,IAAuB,EACvB,IAAuB;IAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;QACjE,OAAO,KAAK,CAAC;KACd;;;QAGK,MAAM,GAAG,IAAI,CAAC,MAAM;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,C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;IAEnB,mDAAkB;;IAElB,mDAAkB;;;;;;;AAIpB,8BAGC;;;;;;;;;;;;;;;;;;;;"}
|
package/fesm5/ngxs-store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __spread, __extends, __values } from 'tslib';
|
|
2
|
-
import { NgZone, Injectable, Inject, PLATFORM_ID, InjectionToken, Optional, SkipSelf, ErrorHandler, Injector,
|
|
2
|
+
import { NgZone, Injectable, Inject, PLATFORM_ID, defineInjectable, inject, InjectionToken, INJECTOR, ɵglobal, Optional, SkipSelf, ErrorHandler, Injector, ɵivyEnabled, NgModule, APP_BOOTSTRAP_LISTENER } from '@angular/core';
|
|
3
3
|
import { isAngularInTestMode, memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
|
|
4
4
|
import { isPlatformServer } from '@angular/common';
|
|
5
5
|
import { Observable, Subject, BehaviorSubject, of, forkJoin, throwError, EMPTY, from } from 'rxjs';
|
|
@@ -164,13 +164,14 @@ var DispatchOutsideZoneNgxsExecutionStrategy = /** @class */ (function () {
|
|
|
164
164
|
return func();
|
|
165
165
|
};
|
|
166
166
|
DispatchOutsideZoneNgxsExecutionStrategy.decorators = [
|
|
167
|
-
{ type: Injectable }
|
|
167
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
168
168
|
];
|
|
169
169
|
/** @nocollapse */
|
|
170
170
|
DispatchOutsideZoneNgxsExecutionStrategy.ctorParameters = function () { return [
|
|
171
171
|
{ type: NgZone },
|
|
172
172
|
{ type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
|
|
173
173
|
]; };
|
|
174
|
+
/** @nocollapse */ DispatchOutsideZoneNgxsExecutionStrategy.ngInjectableDef = defineInjectable({ factory: function DispatchOutsideZoneNgxsExecutionStrategy_Factory() { return new DispatchOutsideZoneNgxsExecutionStrategy(inject(NgZone), inject(PLATFORM_ID)); }, token: DispatchOutsideZoneNgxsExecutionStrategy, providedIn: "root" });
|
|
174
175
|
return DispatchOutsideZoneNgxsExecutionStrategy;
|
|
175
176
|
}());
|
|
176
177
|
if (false) {
|
|
@@ -425,11 +426,72 @@ if (false) {
|
|
|
425
426
|
* @fileoverview added by tsickle
|
|
426
427
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
427
428
|
*/
|
|
429
|
+
var NoopNgxsExecutionStrategy = /** @class */ (function () {
|
|
430
|
+
function NoopNgxsExecutionStrategy() {
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* @template T
|
|
434
|
+
* @param {?} func
|
|
435
|
+
* @return {?}
|
|
436
|
+
*/
|
|
437
|
+
NoopNgxsExecutionStrategy.prototype.enter = /**
|
|
438
|
+
* @template T
|
|
439
|
+
* @param {?} func
|
|
440
|
+
* @return {?}
|
|
441
|
+
*/
|
|
442
|
+
function (func) {
|
|
443
|
+
return func();
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* @template T
|
|
447
|
+
* @param {?} func
|
|
448
|
+
* @return {?}
|
|
449
|
+
*/
|
|
450
|
+
NoopNgxsExecutionStrategy.prototype.leave = /**
|
|
451
|
+
* @template T
|
|
452
|
+
* @param {?} func
|
|
453
|
+
* @return {?}
|
|
454
|
+
*/
|
|
455
|
+
function (func) {
|
|
456
|
+
return func();
|
|
457
|
+
};
|
|
458
|
+
NoopNgxsExecutionStrategy.decorators = [
|
|
459
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
|
460
|
+
];
|
|
461
|
+
/** @nocollapse */ NoopNgxsExecutionStrategy.ngInjectableDef = defineInjectable({ factory: function NoopNgxsExecutionStrategy_Factory() { return new NoopNgxsExecutionStrategy(); }, token: NoopNgxsExecutionStrategy, providedIn: "root" });
|
|
462
|
+
return NoopNgxsExecutionStrategy;
|
|
463
|
+
}());
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* @fileoverview added by tsickle
|
|
467
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
468
|
+
*/
|
|
469
|
+
/**
|
|
470
|
+
* The strategy that might be provided by users through `options.executionStrategy`.
|
|
471
|
+
* @type {?}
|
|
472
|
+
*/
|
|
473
|
+
var USER_PROVIDED_NGXS_EXECUTION_STRATEGY = new InjectionToken('USER_PROVIDED_NGXS_EXECUTION_STRATEGY');
|
|
428
474
|
/*
|
|
429
475
|
* Internal execution strategy injection token
|
|
430
476
|
*/
|
|
431
477
|
/** @type {?} */
|
|
432
|
-
var NGXS_EXECUTION_STRATEGY = new InjectionToken('NGXS_EXECUTION_STRATEGY'
|
|
478
|
+
var NGXS_EXECUTION_STRATEGY = new InjectionToken('NGXS_EXECUTION_STRATEGY', {
|
|
479
|
+
providedIn: 'root',
|
|
480
|
+
factory: (/**
|
|
481
|
+
* @return {?}
|
|
482
|
+
*/
|
|
483
|
+
function () {
|
|
484
|
+
/** @type {?} */
|
|
485
|
+
var injector = inject(INJECTOR);
|
|
486
|
+
/** @type {?} */
|
|
487
|
+
var executionStrategy = injector.get(USER_PROVIDED_NGXS_EXECUTION_STRATEGY);
|
|
488
|
+
return executionStrategy
|
|
489
|
+
? injector.get(executionStrategy)
|
|
490
|
+
: injector.get(typeof ɵglobal.Zone !== 'undefined'
|
|
491
|
+
? DispatchOutsideZoneNgxsExecutionStrategy
|
|
492
|
+
: NoopNgxsExecutionStrategy);
|
|
493
|
+
})
|
|
494
|
+
});
|
|
433
495
|
/**
|
|
434
496
|
* @record
|
|
435
497
|
*/
|
|
@@ -1641,6 +1703,18 @@ var StateStream = /** @class */ (function (_super) {
|
|
|
1641
1703
|
function StateStream() {
|
|
1642
1704
|
return _super.call(this, {}) || this;
|
|
1643
1705
|
}
|
|
1706
|
+
/**
|
|
1707
|
+
* @return {?}
|
|
1708
|
+
*/
|
|
1709
|
+
StateStream.prototype.ngOnDestroy = /**
|
|
1710
|
+
* @return {?}
|
|
1711
|
+
*/
|
|
1712
|
+
function () {
|
|
1713
|
+
// The `StateStream` should never emit values once the root view is removed, e.g. when the `NgModuleRef.destroy()` is called.
|
|
1714
|
+
// This will eliminate memory leaks in server-side rendered apps where the `StateStream` is created per each HTTP request, users
|
|
1715
|
+
// might forget to unsubscribe from `store.select` or `store.subscribe`, thus this will lead to huge memory leaks in SSR apps.
|
|
1716
|
+
this.complete();
|
|
1717
|
+
};
|
|
1644
1718
|
StateStream.decorators = [
|
|
1645
1719
|
{ type: Injectable }
|
|
1646
1720
|
];
|
|
@@ -3835,8 +3909,8 @@ var NgxsModule = /** @class */ (function () {
|
|
|
3835
3909
|
function (states, options) {
|
|
3836
3910
|
return [
|
|
3837
3911
|
{
|
|
3838
|
-
provide:
|
|
3839
|
-
|
|
3912
|
+
provide: USER_PROVIDED_NGXS_EXECUTION_STRATEGY,
|
|
3913
|
+
useValue: options.executionStrategy
|
|
3840
3914
|
},
|
|
3841
3915
|
{
|
|
3842
3916
|
provide: ROOT_STATE_TOKEN,
|
|
@@ -4411,45 +4485,6 @@ function Selector(selectors) {
|
|
|
4411
4485
|
});
|
|
4412
4486
|
}
|
|
4413
4487
|
|
|
4414
|
-
/**
|
|
4415
|
-
* @fileoverview added by tsickle
|
|
4416
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4417
|
-
*/
|
|
4418
|
-
var NoopNgxsExecutionStrategy = /** @class */ (function () {
|
|
4419
|
-
function NoopNgxsExecutionStrategy() {
|
|
4420
|
-
}
|
|
4421
|
-
/**
|
|
4422
|
-
* @template T
|
|
4423
|
-
* @param {?} func
|
|
4424
|
-
* @return {?}
|
|
4425
|
-
*/
|
|
4426
|
-
NoopNgxsExecutionStrategy.prototype.enter = /**
|
|
4427
|
-
* @template T
|
|
4428
|
-
* @param {?} func
|
|
4429
|
-
* @return {?}
|
|
4430
|
-
*/
|
|
4431
|
-
function (func) {
|
|
4432
|
-
return func();
|
|
4433
|
-
};
|
|
4434
|
-
/**
|
|
4435
|
-
* @template T
|
|
4436
|
-
* @param {?} func
|
|
4437
|
-
* @return {?}
|
|
4438
|
-
*/
|
|
4439
|
-
NoopNgxsExecutionStrategy.prototype.leave = /**
|
|
4440
|
-
* @template T
|
|
4441
|
-
* @param {?} func
|
|
4442
|
-
* @return {?}
|
|
4443
|
-
*/
|
|
4444
|
-
function (func) {
|
|
4445
|
-
return func();
|
|
4446
|
-
};
|
|
4447
|
-
NoopNgxsExecutionStrategy.decorators = [
|
|
4448
|
-
{ type: Injectable }
|
|
4449
|
-
];
|
|
4450
|
-
return NoopNgxsExecutionStrategy;
|
|
4451
|
-
}());
|
|
4452
|
-
|
|
4453
4488
|
/**
|
|
4454
4489
|
* @fileoverview added by tsickle
|
|
4455
4490
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4522,5 +4557,5 @@ if (false) {
|
|
|
4522
4557
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4523
4558
|
*/
|
|
4524
4559
|
|
|
4525
|
-
export { Action, Actions, InitState, NGXS_PLUGINS, NgxsModule, NgxsSimpleChange, NoopNgxsExecutionStrategy, Select, Selector, SelectorOptions, State, StateStream, StateToken, Store, UpdateState, actionMatcher, createSelector, ensureSelectorMetadata$1 as ensureSelectorMetadata, ensureStoreMetadata$1 as ensureStoreMetadata, getActionTypeFromInstance, getSelectorMetadata$1 as getSelectorMetadata, getStoreMetadata$1 as getStoreMetadata, getValue, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, setValue, OrderedSubject as ɵa, InternalActions as ɵb, ROOT_STATE_TOKEN as ɵc, FEATURE_STATE_TOKEN as ɵd, SELECTOR_META_KEY as ɵe, NgxsConfig as ɵf, mergeDeep as ɵg,
|
|
4560
|
+
export { Action, Actions, InitState, NGXS_PLUGINS, NgxsModule, NgxsSimpleChange, NoopNgxsExecutionStrategy, Select, Selector, SelectorOptions, State, StateStream, StateToken, Store, UpdateState, actionMatcher, createSelector, ensureSelectorMetadata$1 as ensureSelectorMetadata, ensureStoreMetadata$1 as ensureStoreMetadata, getActionTypeFromInstance, getSelectorMetadata$1 as getSelectorMetadata, getStoreMetadata$1 as getStoreMetadata, getValue, ofAction, ofActionCanceled, ofActionCompleted, ofActionDispatched, ofActionErrored, ofActionSuccessful, setValue, OrderedSubject as ɵa, InternalActions as ɵb, ROOT_STATE_TOKEN as ɵc, FEATURE_STATE_TOKEN as ɵd, SELECTOR_META_KEY as ɵe, NgxsConfig as ɵf, mergeDeep as ɵg, USER_PROVIDED_NGXS_EXECUTION_STRATEGY as ɵh, NGXS_EXECUTION_STRATEGY as ɵi, NgxsRootModule as ɵj, StateFactory as ɵk, InternalDispatchedActionResults as ɵl, InternalDispatcher as ɵm, StateContextFactory as ɵn, InternalStateOperations as ɵo, PluginManager as ɵp, InternalNgxsExecutionStrategy as ɵq, ensureStoreMetadata as ɵs, getStoreMetadata as ɵt, ensureSelectorMetadata as ɵu, getSelectorMetadata as ɵv, LifecycleStateManager as ɵw, NgxsFeatureModule as ɵx };
|
|
4526
4561
|
//# sourceMappingURL=ngxs-store.js.map
|