ngx-store
Version:
Angular decorators to automagically keep variables in HTML5 LocalStorage, SessionStorage, cookies; injectable services for managing and listening to data changes and a bit more.
16 lines (14 loc) • 22.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ts-debug"),require("rxjs/operators"),require("lodash.merge"),require("rxjs"),require("@angular/core")):"function"==typeof define&&define.amd?define("ngx-store",["exports","ts-debug","rxjs/operators","lodash.merge","rxjs","@angular/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["ngx-store"]={},e.tsDebug,e.rxjs.operators,e.merge,e.rxjs,e.ng.core)}(this,(function(e,t,r,i,n,o){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(i),u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}Object.create;function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}Object.create;var l="NGX-STORE_",f=function(){function e(){}return e.getItem=function(e){return localStorage.getItem(l+e)},e.setItem=function(e,t){return localStorage.setItem(l+e,t)},e}(),h={prefix:"ngx_",previousPrefix:"angular2ws_",clearType:"prefix",mutateObjects:!0,cookiesScope:"",cookiesCheckInterval:0,debugMode:!1},g={},y=f.getItem("prefix");"object"==typeof NGXSTORE_CONFIG&&(g=Object.assign({},NGXSTORE_CONFIG)),null!=y?g.previousPrefix=y:void 0===g.previousPrefix&&(g.previousPrefix=h.previousPrefix);var d=Object.assign({},h,g),v=new t.Debugger(console,d.debugMode,"[ngx-store] ");f.setItem("prefix",d.prefix);var m=require("lodash.isequal"),b=function(){function e(){}return e.getCacheFor=function(t){var r=e.get(t.key);return r?(v.log("Loaded prior CacheItem of "+r.name+"\n for "+t.utilities[0].utility.getStorageName()),r.addTargets(t.targets),r.addServices(t.services),r.addUtilities(t.utilities),e.set(r),r):(r=new x(t),v.log("Created new CacheItem for "+t.name+" for "+r.utilities[0].utility.getStorageName()),e.set(r),r)},e.remove=function(t){return e.items.delete(t.key)},e.get=function(t){return e.items.get(t)},e.set=function(t){e.get(t.key)||v.log("CacheItem for "+t.key,t),e.items.set(t.key,t)},e}();b.items=new Map;var x=function(){function e(e){this.name="",this.targets=[],this.services=[],this.utilities=[],this.currentTarget={},this.proxy=null,this._key="",this.initializedTargets=new Set,this._key=e.key,this.name=e.name,this.addTargets(e.targets),this.addServices(e.services),this.addUtilities(e.utilities)}return Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),e.prototype.saveValue=function(e,t){if(void 0===t&&(t={}),v.groupCollapsed("CacheItem#saveValue for "+this.key+" in "+this.currentTarget.constructor.name),v.log("new value: ",e),v.log("previous value: ",this.readValue()),v.log("targets.length: ",this.targets.length),v.log("currentTarget:",this.currentTarget),v.groupEnd(),!this.initializedTargets.has(this.currentTarget)){this.initializedTargets.add(this.currentTarget);var r=this.readValue();t.migrateKey&&(this.migrate(t,this.utilities[0].utility),r=this.readValue());var i=null!=r?r:e,n=this.getProxy(i,t);return n=null!==n?n:e,v.log("initial value for "+this.key+" in "+this.currentTarget.constructor.name,n),this.propagateChange(i),n}return this.propagateChange(e),this.getProxy(e,t)},e.prototype.getProxy=function(e,t){var r,i;if(void 0===t&&(t={}),void 0===e&&this.proxy)return this.proxy;if("object"!=typeof(e=void 0===e?this.readValue():e)||null===e)return this.proxy=e,e;if(!d.mutateObjects&&!t.mutate||!1===t.mutate)return e;var n=this,o=Object.assign(new e.constructor,e.__proto__);if(o.save=function(){n.saveValue(e,t)},Array.isArray(e)){var a=function(e){o[e]=function(){var r=n.readValue(),i=Array.prototype[e].apply(r,arguments);return v.log("Saving value for "+n.key+" by method "+o.constructor.name+"."+e),n.saveValue(r,t),i}};try{for(var s=p(["pop","push","reverse","shift","unshift","splice","filter","forEach","map","fill","sort","copyWithin"]),u=s.next();!u.done;u=s.next()){a(u.value)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}return Object.setPrototypeOf(e,o),this.proxy=e,e},e.prototype.readValue=function(e){void 0===e&&(e={});var t=this.utilities[0],r=t?t.utility.get(this.key,t.config):null;return"object"!=typeof r?r:JSON.parse(JSON.stringify(this.getProxy(r,t.config)))},e.prototype.addTargets=function(e){var t=this;e.forEach((function(e){if(-1===t.targets.indexOf(e)&&"object"==typeof e){var r=e.ngOnDestroy,i=t;e.ngOnDestroy=function(){"function"==typeof r&&r.apply(this,arguments),e.ngOnDestroy=r||function(){},i.initializedTargets.delete(e),i.targets=i.targets.filter((function(t){return t!==e})),i.targets.length||(i.services.forEach((function(e){e.keys=e.keys.filter((function(e){return e!==i._key}))})),i.resetProxy(),b.remove(i)),v.groupCollapsed(i.key+" OnDestroy handler:"),v.log("removed target:",e.constructor.name),v.log("remaining targets:",i.targets),v.log("cacheItem:",b.get(i.key)),v.groupEnd()},t.targets.push(e)}}))},e.prototype.addServices=function(e){var t=this;e.forEach((function(e){-1===t.services.indexOf(e)&&(e.keys.push(t._key),t.services.push(e))}))},e.prototype.addUtilities=function(e){var t=this;e.forEach((function(e){-1===t.utilities.findIndex((function(t){return t.utility===e.utility}))&&(t.utilities.push(e),e.utility.set(t.key,t.readValue()))}))},e.prototype.resetProxy=function(){this.proxy=null},e.prototype.propagateChange=function(e,t){var r=this;m(e,this.readValue())||this.utilities.forEach((function(i){var n=i.utility;n!==t&&(v.log("propagating change on "+r.key+" to:",n),n.set(r._key,e,i.config))}))},e.prototype.migrate=function(e,t){var r=e.prefix||d.prefix||"",i=function(e){return e in t.getStorage()},n=i(r+e.migrateKey)?r+e.migrateKey:e.migrateKey;if(i(n)){v.log("Migrating",n,"to",e.key,"in",t.getStorageName());var o=t.get(n,Object.assign(Object.assign({},e),{prefix:""}));t.set(this._key,o),t.remove(n,{prefix:""})}},e}(),S=function(){function e(t,r,i){this.type=t,this.key=r,this.storageArea=i,this.timeStamp=Date.now()-e.initTimeStamp,this.bubbles=!1,this.cancelBubble=!1,this.cancelable=!1,this.composed=!1,this.currentTarget=window,this.defaultPrevented=!1,this.eventPhase=2,this.isTrusted=!0,this.path=[window],this.returnValue=!0,this.srcElement=window,this.target=window,this.url=window.location.href,this.isInternal=!0}return Object.defineProperty(e.prototype,"initEvent",{get:function(){return StorageEvent.prototype.initEvent.bind(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"preventDefault",{get:function(){return StorageEvent.prototype.preventDefault.bind(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stopImmediatePropagation",{get:function(){return StorageEvent.prototype.stopImmediatePropagation.bind(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stopPropagation",{get:function(){return StorageEvent.prototype.stopPropagation.bind(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"composedPath",{get:function(){return StorageEvent.prototype.composedPath.bind(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"AT_TARGET",{get:function(){return StorageEvent.prototype.AT_TARGET},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"BUBBLING_PHASE",{get:function(){return StorageEvent.prototype.BUBBLING_PHASE},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CAPTURING_PHASE",{get:function(){return StorageEvent.prototype.BUBBLING_PHASE},enumerable:!1,configurable:!0}),e}();S.initTimeStamp=Date.now();var k=require("lodash.get"),_=require("lodash.set"),P=require("lodash.merge"),O=function(){function e(e,t){this.service=e,this.key=t,this._defaultValue=null,this._path=[],this._prefix=d.prefix}return Object.defineProperty(e.prototype,"defaultValue",{get:function(){return this._defaultValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this.pathString},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"prefix",{get:function(){return this._prefix||""},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.considerDefault(this.readValue())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fullValue",{get:function(){return this.considerDefault(this.service.utility.get(this.key,{prefix:this._prefix}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pathString",{get:function(){return this._path.join(".")},enumerable:!1,configurable:!0}),e.prototype.setPath=function(e){return this._path=e.split("."),this},e.prototype.appendPath=function(e){return this._path.push(e),this},e.prototype.truncatePath=function(){return this._path.pop(),this},e.prototype.resetPath=function(){return this._path=[],this},e.prototype.setPrefix=function(e){return this._prefix=e,this},e.prototype.changePrefix=function(e){return this.service.utility.set(this.key,this.fullValue,{prefix:e}),this.service.utility.remove(this.key,{prefix:this._prefix}),this.setPrefix(e)},e.prototype.setDefaultValue=function(e){this._defaultValue=e;var t=this.readValue();return this.isNullOrUndefined(t)&&this.save(e),this},e.prototype.save=function(e){return this.pathString&&(e=_(this.fullValue,this.pathString,this.considerDefault(e))),this.service.utility.set(this.key,this.considerDefault(e),{prefix:this._prefix}),this},e.prototype.update=function(e){return this.save(P(this.readValue(),e))},e.prototype.remove=function(){return this.service.utility.remove(this.key),this},e.prototype.considerDefault=function(e){return this.isNullOrUndefined(e)?this._defaultValue:e},e.prototype.isNullOrUndefined=function(e){return null==e},e.prototype.readValue=function(){var e=this.service.utility.get(this.key,{prefix:this._prefix});return this.pathString?k(e,this.pathString):e},e}(),j=function(){function e(e){this.utility=e}return Object.defineProperty(e.prototype,"keys",{get:function(){var e=this,t=this.utility.keys.filter((function(t){return!e.utility.prefix||!e.utility.prefix.length||t.startsWith(e.utility.prefix)})),r=this.constructor.keys;return t.concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"config",{get:function(){return d},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this.utility.get(e)},e.prototype.load=function(e){return new O(this,e)},e.prototype.set=function(e,t){return this.utility.set(e,t)},e.prototype.update=function(e,t){var r=this.get(e);return void 0!==r&&"object"!=typeof r?(v.throw(new Error('Value stored under "'+e+'" key is not an object and tried to be updated.')),r):this.set(e,s.default({},r,t))},e.prototype.remove=function(e){return this.utility.remove(e)},e.prototype.observe=function(e,t){return this._changes.pipe(r.filter((function(r){var i;return!e||(t?d.prefix&&e.startsWith(d.prefix)?r.key===e:r.key===d.prefix+e:-1!==(null===(i=r.key)||void 0===i?void 0:i.indexOf(e)))})),r.delay(30))},e.prototype.clear=function(e,t){var r=this;if("decorators"===(e=e||d.clearType)){var i=[];"object"==typeof t?(i=this.keys.filter((function(e){return b.get(e).targets.includes(t)})),v.log(this.utility.getStorageName()+" > Removing decorated data from "+t.constructor.name+":",i)):(i=this.keys,v.log(this.utility.getStorageName()+" > Removing decorated data:",i)),i.forEach((function(e){return r.remove(e)}))}else"prefix"===e?(t=t||this.utility.prefix,this.utility.forEach((function(e,i){i.startsWith(t)&&r.remove(r.utility.trimPrefix(i))}))):"all"===e&&this.utility.clear()},e.prototype.generateEvent=function(e,t,r){var i=this.utility.getStorageName().charAt(0).toLowerCase()+this.utility.getStorageName().slice(1),n=new S(i,e,this.utility.getStorage());return n.oldValue=void 0!==r?r:this.get(e),n.newValue=t,n},e.prototype.mapNativeEvent=function(e){var t=this.generateEvent(e.key,this.utility.getGettable(e.newValue),this.utility.getGettable(e.oldValue));return t.isInternal=!1,t},e}();j.keys=[];var w=function(){function e(e,t,r){var i=this;void 0===t&&(t=""),this._prefix="",this._changes=new n.Subject,this._storage=e,this._prefix=t,t!==r&&null!=r&&(v.log(this.getStorageName()+" > Detected prefix change from "+r+" to "+t),this.forEach((function(e,t){if(t.startsWith(r)&&!t.startsWith(l)){var n=i.trimPrefix(t);i.set(n,i._storage.getItem(t)),""!==r&&i._storage.removeItem(t)}})))}return Object.defineProperty(e.prototype,"prefix",{get:function(){return this._prefix},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"changes",{get:function(){return this._changes.asObservable()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"keys",{get:function(){var e=[];return this.forEach((function(t,r){return e.push(r)})),e},enumerable:!1,configurable:!0}),e.getSettable=function(e){return JSON.stringify(e)},e.getGettable=function(e){if("undefined"===e)return null;try{return JSON.parse(e)}catch(t){return e}},e.prototype.getStorage=function(){return this._storage},e.prototype.getStorageKey=function(e,t){return""+(t="string"==typeof t?t:this.prefix)+e},e.prototype.getStorageName=function(){return this._storage.type||(this._storage===localStorage?"localStorage":"sessionStorage")},e.prototype.get=function(e,t){void 0===t&&(t={});var r=this.getStorageKey(e,t.prefix),i=this._storage.getItem(r);return this.getGettable(i)},e.prototype.set=function(e,t,r){if(void 0===r&&(r={}),null==t)return this.remove(e),null;try{var i=this.getStorageKey(e,r.prefix),n=this.getSettable(t);this.emitEvent(e,t),this._storage.setItem(i,n,r.expires);var o=b.get(e);o&&(v.log("updating following CacheItem from "+this.constructor.name+":",o),o.resetProxy(),o.propagateChange(t,this))}catch(r){console.warn("[ngx-store] "+this.getStorageName()+":\n following error occurred while trying to save "+e+" =",t),console.error(r)}return t},e.prototype.remove=function(e,t){void 0===t&&(t={});var r=this.getStorageKey(e,t.prefix);this._storage.removeItem(r);var i=b.get(e);i&&i.resetProxy()},e.prototype.clear=function(){var e=this;this.emitEvent(null,null,null),this.forEach((function(t,r){r.startsWith(l)||e.remove(r,{prefix:""})}))},e.prototype.forEach=function(e){var t=this;if("function"==typeof this._storage.forEach)return this._storage.forEach((function(r,i){e(t.getGettable(r),i)}));Object.keys(this._storage).forEach((function(r){e(t.getGettable(t._storage[r]),r)}))},e.prototype.getSettable=function(t){return e.getSettable(t)},e.prototype.getGettable=function(t){return e.getGettable(t)},e.prototype.trimPrefix=function(e){return e.replace(this.prefix,"")},e.prototype.emitEvent=function(e,t,r){var i=new S(this.getStorageName(),e,this._storage);i.oldValue=void 0!==r?r:this.get(e),i.newValue=t,this._changes.next(i)},e}(),E=function(){function e(){this.externalChanges=new n.Subject}return e.prototype.emitEvent=function(e,t,r){var i,n=new S(this.type,e,this);n.oldValue=void 0!==r?r:this.getItem(e),n.newValue=t,n.isInternal=!1,null===(i=this.externalChanges)||void 0===i||i.next(n)},e}(),I=new(function(e){function t(){var t=e.call(this)||this;return t.cachedCookieString="",t.cachedItemsMap=new Map,t.getAllItems(),d.cookiesCheckInterval&&n.interval(d.cookiesCheckInterval).subscribe((function(){var e;(null===(e=t.externalChanges)||void 0===e?void 0:e.observers.length)&&t.getAllItems()})),t}return c(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return"cookiesStorage"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getAllKeys().length},enumerable:!1,configurable:!0}),t.prototype.key=function(e){return this.getAllKeys()[e]},t.prototype.getItem=function(e){return this.getAllItems().get(e)},t.prototype.removeItem=function(e){if("undefined"!=typeof document){var t=this.resolveDomain(d.cookiesScope);t=t?"domain="+t+";":"",document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;"+t,this.cachedItemsMap.delete(e)}},t.prototype.setItem=function(e,t,r){if("undefined"!=typeof document){var i=this.resolveDomain(d.cookiesScope);v.log("Cookies domain:",i),i=i?"domain="+i+";":"";var n="";r instanceof Date?n=r.toUTCString():null===r&&(n="Fri, 18 Dec 2099 12:00:00 GMT");var o=e+"="+t+(n?"; expires="+n:"")+";path=/;"+i;v.log("Cookie`s set instruction:",o),this.cachedItemsMap.set(e,t),document.cookie=o}},t.prototype.clear=function(){var e=this;this.getAllKeys().forEach((function(t){return e.removeItem(t)}))},t.prototype.forEach=function(e){return this.getAllItems().forEach((function(t,r){return e(t,r)}))},t.prototype.getAllKeys=function(){return Array.from(this.getAllItems().keys())},t.prototype.getAllItems=function(){var e=this;if(this.cachedCookieString===document.cookie)return this.cachedItemsMap;var t=new Map;if("undefined"==typeof document)return t;for(var r=document.cookie.split(";"),i=0;i<r.length;i++){var n=r[i].trim(),o=n.indexOf("="),a=o>-1?n.substr(0,o):n,s=o>-1?n.substr(o+1,n.length):n;t.set(a,s)}return this.cachedItemsMap&&(t.forEach((function(t,r){var i=e.cachedItemsMap.get(r);t!==(i=void 0!==i?i:null)&&e.emitEvent(r,w.getGettable(t),w.getGettable(i))})),this.cachedItemsMap.forEach((function(r,i){t.has(i)||e.emitEvent(i,null,w.getGettable(r))}))),this.cachedCookieString=document.cookie,this.cachedItemsMap=t},t.prototype.resolveDomain=function(e){if(!e)return"";var t=document.domain;return(t.match(/\./g)||[]).length<1?"":("."!==e[0]&&0===t.indexOf("www.")?"www.":"")+e+this.getDomain()},t.prototype.getDomain=function(){for(var e=0,t=document.domain,r=t.split("."),i="_gd"+(new Date).getTime();e<r.length-1&&-1===document.cookie.indexOf(i+"="+i);)t=r.slice(-1-++e).join("."),document.cookie=i+"="+i+";domain="+t+";";return document.cookie=i+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT;domain="+t+";",t},t}(E)),T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.getSettable=function(e){return e},t.prototype.getGettable=function(e){return e},t}(w),C=new(function(e){function t(){var t=e.call(this)||this;return t.sharedMap=new Map,delete t.externalChanges,t}return c(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return"sharedStorage"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this.getAllKeys().length},enumerable:!1,configurable:!0}),t.prototype.key=function(e){return this.getAllKeys()[e]},t.prototype.getItem=function(e){var t=this.sharedMap.get(e);return void 0!==t?t:null},t.prototype.removeItem=function(e){this.sharedMap.delete(e)},t.prototype.setItem=function(e,t){this.sharedMap.set(e,t)},t.prototype.clear=function(){this.sharedMap.clear()},t.prototype.forEach=function(e){return this.sharedMap.forEach((function(t,r){return e(t,r)}))},t.prototype.getAllKeys=function(){return Array.from(this.sharedMap.keys())},t}(E)),V=new w(localStorage,d.prefix,d.previousPrefix),N=new w(sessionStorage,d.prefix,d.previousPrefix),A=new w(I,d.prefix,d.previousPrefix),M=new T(C,d.prefix,d.prefix),G=function(e){function t(){var t=e.call(this,V)||this;return t._changes=n.merge(n.fromEvent(window,"storage").pipe(r.filter((function(e){return e.storageArea===localStorage})),r.map((function(e){return t.mapNativeEvent(e)}))),V.changes),t}return c(t,e),t}(j);G.keys=[],G.decorators=[{type:o.Injectable}],G.ctorParameters=function(){return[]};var D=function(e){function t(){var t=e.call(this,N)||this;return t._changes=n.merge(n.fromEvent(window,"storage").pipe(r.filter((function(e){return e.storageArea===sessionStorage})),r.map((function(e){return t.mapNativeEvent(e)}))),N.changes),t}return c(t,e),t}(j);D.keys=[],D.decorators=[{type:o.Injectable}],D.ctorParameters=function(){return[]};var K=function(e){function t(){var t,r=this;return(r=e.call(this,A)||this)._changes=I.externalChanges?n.merge(null===(t=I.externalChanges)||void 0===t?void 0:t.asObservable(),A.changes):A.changes,r}return c(t,e),t.prototype.set=function(e,t,r){return this.utility.set(e,t,{expires:r})},t}(j);K.keys=[],K.decorators=[{type:o.Injectable}],K.ctorParameters=function(){return[]};var U=function(e){function t(){var t=e.call(this,M)||this;return t._changes=M.changes,t}return c(t,e),t}(j);function q(e,t){return B(M,U,e,t)}function B(e,t,r,i){return void 0===i&&(i={}),function(n,o){var a="";"object"==typeof r?(a=r.key||"",i=r):"string"==typeof r&&(a=r),a=a||i.key||o;var s=b.getCacheFor({key:a,name:o,targets:[n],services:[t],utilities:[{utility:e,config:i}]});return Object.defineProperty(n,o,{get:function(){return s.getProxy(void 0,i)},set:function(e){b.get(s.key)||(s=b.getCacheFor(s)),s.addTargets([n]),s.currentTarget=n,s.saveValue(e,i)},configurable:!0}),n}}U.keys=[],U.decorators=[{type:o.Injectable}],U.ctorParameters=function(){return[]};var R=function(){function e(){}return e.forRoot=function(){return{ngModule:e}},e.forChild=function(){return e},e}();R.decorators=[{type:o.NgModule,args:[{declarations:[],imports:[],exports:[],providers:[G,D,K,U]}]}],e.CookieStorage=function(e,t){return B(A,K,e,t)},e.CookieStorageService=K,e.CookiesStorageService=K,e.LocalStorage=function(e,t){return B(V,G,e,t)},e.LocalStorageService=G,e.NgxResource=O,e.NgxStorageEvent=S,e.NgxStoreModule=R,e.SessionStorage=function(e,t){return B(N,D,e,t)},e.SessionStorageService=D,e.SharedStorage=q,e.SharedStorageService=U,e.TempStorage=q,e.TempStorageService=U,e.WebStorageModule=R,e.WebStorageService=j,e.ɵa=w,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-store.umd.min.js.map