@ngxs/storage-plugin
Advanced tools
Comparing version 2.0.0-rc.23 to 2.0.0-rc.24
@@ -56,3 +56,4 @@ (function (global, factory) { | ||
var options = this._options || ({}); | ||
var isInitAction = store.getActionTypeFromInstance(event) === '@@INIT'; | ||
var actionType = store.getActionTypeFromInstance(event); | ||
var isInitAction = actionType === store.InitState.type || actionType === store.UpdateState.type; | ||
var keys = Array.isArray(options.key) ? options.key : [options.key]; | ||
@@ -59,0 +60,0 @@ if (isInitAction) { |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@ngxs/store"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngxs/storage-plugin",["exports","@angular/core","@ngxs/store","rxjs/operators"],r):r((e.ngxs=e.ngxs||{},e.ngxs["storage-plugin"]={}),e.ng.core,e["ngxs-store"],e.Rx.Observable.prototype)}(this,function(e,r,p,S){"use strict";function y(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}}var t={LocalStorage:0,SessionStorage:1};t[t.LocalStorage]="LocalStorage",t[t.SessionStorage]="SessionStorage";var n=new r.InjectionToken("NGXS_STORAGE_PLUGIN_OPTION"),o=new r.InjectionToken("STORAGE_ENGINE"),a=function(){function e(e,r){this._options=e,this._engine=r}return e.prototype.handle=function(e,r,t){var n,o,u=this,l=this._options||{},c="@@INIT"===p.getActionTypeFromInstance(r),g=Array.isArray(l.key)?l.key:[l.key];if(c)try{for(var a=y(g),i=a.next();!i.done;i=a.next()){var s=i.value,f=this._engine.getItem(s);"undefined"!==f&&null!==f&&(f=l.deserialize(f),e="@@STATE"!==s?p.setValue(e,s,f):f)}}catch(d){n={error:d}}finally{try{i&&!i.done&&(o=a["return"])&&o.call(a)}finally{if(n)throw n.error}}return t(e,r).pipe(S.tap(function(e){if(!c)try{for(var r=y(g),t=r.next();!t.done;t=r.next()){var n=t.value,o=e;"@@STATE"!==n&&(o=p.getValue(e,n)),u._engine.setItem(n,l.serialize(o))}}catch(s){a={error:s}}finally{try{t&&!t.done&&(i=r["return"])&&i.call(r)}finally{if(a)throw a.error}}var a,i}))},e}();function i(e){return Object.assign({key:"@@STATE",storage:t.LocalStorage,serialize:JSON.stringify,deserialize:JSON.parse},e)}function s(e){return e.storage===t.LocalStorage?localStorage:e.storage===t.SessionStorage?sessionStorage:null}a.decorators=[{type:r.Injectable}],a.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[n]}]},{type:undefined,decorators:[{type:r.Inject,args:[o]}]}]};var u=new r.InjectionToken("USER_OPTIONS"),l=function(){function r(){}return r.forRoot=function(e){return{ngModule:r,providers:[{provide:u,useValue:e},{provide:p.NGXS_PLUGINS,useClass:a,multi:!0},{provide:n,useFactory:i,deps:[u]},{provide:o,useFactory:s,deps:[n]}]}},r}();l.decorators=[{type:r.NgModule}],l.ctorParameters=function(){return[]},e.NgxsStoragePluginModule=l,e.NgxsStoragePlugin=a,e.StorageOption=t,e.NGXS_STORAGE_PLUGIN_OPTIONS=n,e.STORAGE_ENGINE=o,e.ɵc=u,e.ɵb=s,e.ɵa=i,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@ngxs/store"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngxs/storage-plugin",["exports","@angular/core","@ngxs/store","rxjs/operators"],r):r((e.ngxs=e.ngxs||{},e.ngxs["storage-plugin"]={}),e.ng.core,e["ngxs-store"],e.Rx.Observable.prototype)}(this,function(e,r,S,y){"use strict";function v(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}}var t={LocalStorage:0,SessionStorage:1};t[t.LocalStorage]="LocalStorage",t[t.SessionStorage]="SessionStorage";var n=new r.InjectionToken("NGXS_STORAGE_PLUGIN_OPTION"),o=new r.InjectionToken("STORAGE_ENGINE"),a=function(){function e(e,r){this._options=e,this._engine=r}return e.prototype.handle=function(e,r,t){var n,o,u=this,l=this._options||{},a=S.getActionTypeFromInstance(r),c=a===S.InitState.type||a===S.UpdateState.type,g=Array.isArray(l.key)?l.key:[l.key];if(c)try{for(var i=v(g),s=i.next();!s.done;s=i.next()){var f=s.value,p=this._engine.getItem(f);"undefined"!==p&&null!==p&&(p=l.deserialize(p),e="@@STATE"!==f?S.setValue(e,f,p):p)}}catch(d){n={error:d}}finally{try{s&&!s.done&&(o=i["return"])&&o.call(i)}finally{if(n)throw n.error}}return t(e,r).pipe(y.tap(function(e){if(!c)try{for(var r=v(g),t=r.next();!t.done;t=r.next()){var n=t.value,o=e;"@@STATE"!==n&&(o=S.getValue(e,n)),u._engine.setItem(n,l.serialize(o))}}catch(s){a={error:s}}finally{try{t&&!t.done&&(i=r["return"])&&i.call(r)}finally{if(a)throw a.error}}var a,i}))},e}();function i(e){return Object.assign({key:"@@STATE",storage:t.LocalStorage,serialize:JSON.stringify,deserialize:JSON.parse},e)}function s(e){return e.storage===t.LocalStorage?localStorage:e.storage===t.SessionStorage?sessionStorage:null}a.decorators=[{type:r.Injectable}],a.ctorParameters=function(){return[{type:undefined,decorators:[{type:r.Inject,args:[n]}]},{type:undefined,decorators:[{type:r.Inject,args:[o]}]}]};var u=new r.InjectionToken("USER_OPTIONS"),l=function(){function r(){}return r.forRoot=function(e){return{ngModule:r,providers:[{provide:u,useValue:e},{provide:S.NGXS_PLUGINS,useClass:a,multi:!0},{provide:n,useFactory:i,deps:[u]},{provide:o,useFactory:s,deps:[n]}]}},r}();l.decorators=[{type:r.NgModule}],l.ctorParameters=function(){return[]},e.NgxsStoragePluginModule=l,e.NgxsStoragePlugin=a,e.StorageOption=t,e.NGXS_STORAGE_PLUGIN_OPTIONS=n,e.STORAGE_ENGINE=o,e.ɵc=u,e.ɵb=s,e.ɵa=i,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngxs-storage-plugin.umd.min.js.map |
import { InjectionToken, Inject, Injectable, NgModule } from '@angular/core'; | ||
import { getActionTypeFromInstance, setValue, getValue, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { getActionTypeFromInstance, setValue, getValue, InitState, UpdateState, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { tap } from 'rxjs/operators'; | ||
@@ -47,3 +47,4 @@ | ||
const /** @type {?} */ options = this._options || /** @type {?} */ ({}); | ||
const /** @type {?} */ isInitAction = getActionTypeFromInstance(event) === '@@INIT'; | ||
const /** @type {?} */ actionType = getActionTypeFromInstance(event); | ||
const /** @type {?} */ isInitAction = actionType === InitState.type || actionType === UpdateState.type; | ||
const /** @type {?} */ keys = Array.isArray(options.key) ? options.key : [options.key]; | ||
@@ -50,0 +51,0 @@ if (isInitAction) { |
import { __values } from 'tslib'; | ||
import { InjectionToken, Inject, Injectable, NgModule } from '@angular/core'; | ||
import { getActionTypeFromInstance, setValue, getValue, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { getActionTypeFromInstance, setValue, getValue, InitState, UpdateState, NGXS_PLUGINS } from '@ngxs/store'; | ||
import { tap } from 'rxjs/operators'; | ||
@@ -22,3 +22,4 @@ | ||
var options = this._options || ({}); | ||
var isInitAction = getActionTypeFromInstance(event) === '@@INIT'; | ||
var actionType = getActionTypeFromInstance(event); | ||
var isInitAction = actionType === InitState.type || actionType === UpdateState.type; | ||
var keys = Array.isArray(options.key) ? options.key : [options.key]; | ||
@@ -25,0 +26,0 @@ if (isInitAction) { |
{ | ||
"name": "@ngxs/storage-plugin", | ||
"description": "extendable storage plugin for @ngxs/store", | ||
"version": "2.0.0-rc.23", | ||
"version": "2.0.0-rc.24", | ||
"peerDependencies": { | ||
"@ngxs/store": "2.0.0-rc.23", | ||
"@ngxs/store": "2.0.0-rc.24", | ||
"@angular/core": "^5.0.0" | ||
@@ -8,0 +8,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75759
542