@ngx-pwa/local-storage
Advanced tools
Comparing version 6.0.0-beta.2 to 6.0.0-beta.3
@@ -881,3 +881,3 @@ (function (global, factory) { | ||
*/ | ||
LocalStorage.prototype.setItemAndSubscribe = /** | ||
LocalStorage.prototype.setItemSubscribe = /** | ||
* Sets an item in local storage, and auto-subscribes | ||
@@ -900,3 +900,3 @@ * @param {?} key The item's key | ||
*/ | ||
LocalStorage.prototype.removeItemAndSubscribe = /** | ||
LocalStorage.prototype.removeItemSubscribe = /** | ||
* Deletes an item in local storage, and auto-subscribes | ||
@@ -914,3 +914,3 @@ * @param {?} key The item's key | ||
*/ | ||
LocalStorage.prototype.clearAndSubscribe = /** | ||
LocalStorage.prototype.clearSubscribe = /** | ||
* Deletes all items from local storage, and auto-subscribes | ||
@@ -917,0 +917,0 @@ * @return {?} |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","rxjs/operators","@angular/common"],e):e((t.ngxPWA=t.ngxPWA||{},t.ngxPWA.localStorage=t.ngxPWA.localStorage||{}),t.ng.core,t.Rx,t.Rx.operators,t.ng.common)}(this,function(t,e,r,o,n){"use strict";function a(t){return n.isPlatformBrowser(t)&&"indexedDB"in window&&void 0!==indexedDB&&null!==indexedDB?new u:n.isPlatformBrowser(t)&&"localStorage"in window&&void 0!==localStorage&&null!==localStorage?new c:new l}var i=function(){return function(){}}(),s=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),u=function(t){function n(){var e=t.call(this)||this;return e.dbName="ngStorage",e.objectStoreName="localStorage",e.keyPath="key",e.dataPath="value",e.database=new r.ReplaySubject,e.connect(),e}return s(n,t),n.prototype.getItem=function(t){var e=this;return this.transaction().pipe(o.map(function(e){return e.get(t)}),o.mergeMap(function(t){var n=r.fromEvent(t,"success").pipe(o.map(function(t){return t.target.result}),o.map(function(t){return t&&e.dataPath in t?t[e.dataPath]:null}));return r.race(n,e.toErrorObservable(t,"getter")).pipe(o.first())}),o.first())},n.prototype.setItem=function(t,e){var n=this;return null==e?r.of(!0):this.getItem(t).pipe(o.map(function(t){return null==t?"add":"put"}),o.mergeMap(function(a){return n.transaction("readwrite").pipe(o.mergeMap(function(i){var s;switch(a){case"add":s=i.add((u={},u[n.dataPath]=e,u),t);break;case"put":default:s=i.put((p={},p[n.dataPath]=e,p),t)}return r.race(n.toSuccessObservable(s),n.toErrorObservable(s,"setter")).pipe(o.first());var u,p}))}),o.first())},n.prototype.removeItem=function(t){var e=this;return this.getItem(t).pipe(o.mergeMap(function(n){return null!=n?e.transaction("readwrite").pipe(o.mergeMap(function(n){var a=n.delete(t);return r.race(e.toSuccessObservable(a),e.toErrorObservable(a,"remover")).pipe(o.first())})):r.of(!0)}),o.first())},n.prototype.clear=function(){var t=this;return this.transaction("readwrite").pipe(o.mergeMap(function(e){var n=e.clear();return r.race(t.toSuccessObservable(n),t.toErrorObservable(n,"clearer")).pipe(o.first())}),o.first())},n.prototype.connect=function(){var t=this,e=indexedDB.open(this.dbName);r.fromEvent(e,"upgradeneeded").pipe(o.first()).subscribe(function(e){var r=e.target.result;r.objectStoreNames.contains(t.objectStoreName)||r.createObjectStore(t.objectStoreName)});var n=r.fromEvent(e,"success");r.race(n,this.toErrorObservable(e,"connection")).pipe(o.first()).subscribe(function(e){t.database.next(e.target.result)},function(e){t.database.error(e)})},n.prototype.transaction=function(t){var e=this;return void 0===t&&(t="readonly"),this.database.pipe(o.map(function(r){return r.transaction([e.objectStoreName],t).objectStore(e.objectStoreName)}))},n.prototype.toSuccessObservable=function(t){return r.fromEvent(t,"success").pipe(o.map(function(){return!0}))},n.prototype.toErrorObservable=function(t,e){return void 0===e&&(e=""),r.fromEvent(t,"error").pipe(o.mergeMap(function(o){return r.throwError(new Error("IndexedDB "+e+" issue : "+t.error.message+"."))}))},n.decorators=[{type:e.Injectable}],n.ctorParameters=function(){return[]},n}(i),p=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),c=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.localStorage=localStorage,e}return p(o,t),o.prototype.getItem=function(t){var e=this.localStorage.getItem(t),o=null;if(null!=e)try{o=JSON.parse(e)}catch(t){return r.throwError(new Error("Invalid data in localStorage."))}return r.of(o)},o.prototype.setItem=function(t,e){return this.localStorage.setItem(t,JSON.stringify(e)),r.of(!0)},o.prototype.removeItem=function(t){return this.localStorage.removeItem(t),r.of(!0)},o.prototype.clear=function(){return this.localStorage.clear(),r.of(!0)},o.decorators=[{type:e.Injectable}],o}(i),f=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),l=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.localStorage=new Map,e}return f(o,t),o.prototype.getItem=function(t){var e=this.localStorage.get(t);return r.of(void 0!==e?e:null)},o.prototype.setItem=function(t,e){return this.localStorage.set(t,e),r.of(!0)},o.prototype.removeItem=function(t){return this.localStorage.delete(t),r.of(!0)},o.prototype.clear=function(){return this.localStorage.clear(),r.of(!0)},o.decorators=[{type:e.Injectable}],o}(i),y=function(){function t(){this.simpleTypes=["string","number","boolean","object"]}return t.prototype.isObjectNotNull=function(t){return null!==t&&"object"==typeof t},t.prototype.validate=function(t,e){if(!this.isObjectNotNull(e))throw new Error("A schema must be an object (unlike spec, booleans are not supported to enforce strict types).");if(!(e.hasOwnProperty("type")&&"array"!==e.type&&"object"!==e.type||e.hasOwnProperty("properties")||e.hasOwnProperty("items")))throw new Error("Each value must have a 'type' or 'properties' or 'items', to enforce strict types.");if(e.hasOwnProperty("type")&&!this.validateType(t,e))return!1;if(e.hasOwnProperty("items")&&!this.validateItems(t,e))return!1;if(e.hasOwnProperty("properties")){if(e.hasOwnProperty("required")&&!this.validateRequired(t,e))return!1;if(!this.validateProperties(t,e))return!1}return!0},t.prototype.validateProperties=function(t,e){if(!this.isObjectNotNull(t))return!1;if(!e.properties||!this.isObjectNotNull(e.properties))throw new Error("'properties' must be a schema object.");if(Object.keys(e.properties).length!==Object.keys(t).length)return!1;for(var r in e.properties)if(e.properties.hasOwnProperty(r)&&t.hasOwnProperty(r)&&!this.validate(t[r],e.properties[r]))return!1;return!0},t.prototype.validateRequired=function(t,e){if(!this.isObjectNotNull(t))return!1;if(!Array.isArray(e.required))throw new Error("'required' field must be an array. Note that since JSON Schema draft 6, booleans are not supported anymore.");for(var r=0,o=e.required;r<o.length;r++){var n=o[r];if("string"!=typeof n)throw new Error("'required' array must contain strings only.");if(!e.properties||!e.properties.hasOwnProperty(n))throw new Error("'required' properties must be described in 'properties' too.");if(!t.hasOwnProperty(n))return!1}return!0},t.prototype.validateType=function(t,e){if(Array.isArray(e.type))return this.validateTypeList(t,e);if("string"!=typeof e.type)throw new Error("'type' must be a string (arrays of types are not supported yet).");return("null"!==e.type||null===t)&&((-1===this.simpleTypes.indexOf(e.type)||typeof t===e.type)&&!!("integer"!==e.type||"number"==typeof t&&Number.isInteger(t)))},t.prototype.validateTypeList=function(t,e){for(var r=[],o=0,n=e.type;o<n.length;o++){var a=n[o];r.push(this.validateType(t,{type:a}))}return-1!==r.indexOf(!0)},t.prototype.validateItems=function(t,e){if(!Array.isArray(t))return!1;if(Array.isArray(e.items))return this.validateItemsList(t,e);if(!e.items||!this.isObjectNotNull(e.items))throw new Error("'items' must be a schema object.");for(var r=0,o=t;r<o.length;r++){var n=o[r];if(!this.validate(n,e.items))return!1}return!0},t.prototype.validateItemsList=function(t,e){var r=e.items;if(t.length!==r.length)return!1;for(var o=0;o<r.length;o+=1)if(!this.validate(t[o],r[o]))return!1;return!0},t}(),d=function(){function t(t,e){this.database=t,this.jsonValidator=e,this.getItemOptionsDefault={schema:null}}return t.prototype.getItem=function(t,e){var n=this;return void 0===e&&(e=this.getItemOptionsDefault),this.database.getItem(t).pipe(o.mergeMap(function(t){if(e.schema&&null!==t){var o=!0;try{o=n.jsonValidator.validate(t,e.schema)}catch(t){return r.throwError(t)}if(!o)return r.throwError(new Error("JSON invalid"))}return r.of(t)}))},t.prototype.setItem=function(t,e){return this.database.setItem(t,e)},t.prototype.removeItem=function(t){return this.database.removeItem(t)},t.prototype.clear=function(){return this.database.clear()},t.prototype.setItemAndSubscribe=function(t,e){this.setItem(t,e).subscribe(function(){},function(){})},t.prototype.removeItemAndSubscribe=function(t){this.removeItem(t).subscribe(function(){},function(){})},t.prototype.clearAndSubscribe=function(){this.clear().subscribe(function(){},function(){})},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:i},{type:y}]},t}(),h=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{providers:[y,{provide:i,useFactory:a,deps:[e.PLATFORM_ID]},d]}]}],t}();t.LocalDatabase=i,t.IndexedDBDatabase=u,t.LocalStorageDatabase=c,t.MockLocalDatabase=l,t.JSONValidator=y,t.LocalStorage=d,t.LocalStorageModule=h,t.ɵa=a,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","rxjs","rxjs/operators","@angular/common"],e):e((t.ngxPWA=t.ngxPWA||{},t.ngxPWA.localStorage=t.ngxPWA.localStorage||{}),t.ng.core,t.Rx,t.Rx.operators,t.ng.common)}(this,function(t,e,r,o,n){"use strict";function a(t){return n.isPlatformBrowser(t)&&"indexedDB"in window&&void 0!==indexedDB&&null!==indexedDB?new u:n.isPlatformBrowser(t)&&"localStorage"in window&&void 0!==localStorage&&null!==localStorage?new c:new l}var i=function(){return function(){}}(),s=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),u=function(t){function n(){var e=t.call(this)||this;return e.dbName="ngStorage",e.objectStoreName="localStorage",e.keyPath="key",e.dataPath="value",e.database=new r.ReplaySubject,e.connect(),e}return s(n,t),n.prototype.getItem=function(t){var e=this;return this.transaction().pipe(o.map(function(e){return e.get(t)}),o.mergeMap(function(t){var n=r.fromEvent(t,"success").pipe(o.map(function(t){return t.target.result}),o.map(function(t){return t&&e.dataPath in t?t[e.dataPath]:null}));return r.race(n,e.toErrorObservable(t,"getter")).pipe(o.first())}),o.first())},n.prototype.setItem=function(t,e){var n=this;return null==e?r.of(!0):this.getItem(t).pipe(o.map(function(t){return null==t?"add":"put"}),o.mergeMap(function(a){return n.transaction("readwrite").pipe(o.mergeMap(function(i){var s;switch(a){case"add":s=i.add((u={},u[n.dataPath]=e,u),t);break;case"put":default:s=i.put((p={},p[n.dataPath]=e,p),t)}return r.race(n.toSuccessObservable(s),n.toErrorObservable(s,"setter")).pipe(o.first());var u,p}))}),o.first())},n.prototype.removeItem=function(t){var e=this;return this.getItem(t).pipe(o.mergeMap(function(n){return null!=n?e.transaction("readwrite").pipe(o.mergeMap(function(n){var a=n.delete(t);return r.race(e.toSuccessObservable(a),e.toErrorObservable(a,"remover")).pipe(o.first())})):r.of(!0)}),o.first())},n.prototype.clear=function(){var t=this;return this.transaction("readwrite").pipe(o.mergeMap(function(e){var n=e.clear();return r.race(t.toSuccessObservable(n),t.toErrorObservable(n,"clearer")).pipe(o.first())}),o.first())},n.prototype.connect=function(){var t=this,e=indexedDB.open(this.dbName);r.fromEvent(e,"upgradeneeded").pipe(o.first()).subscribe(function(e){var r=e.target.result;r.objectStoreNames.contains(t.objectStoreName)||r.createObjectStore(t.objectStoreName)});var n=r.fromEvent(e,"success");r.race(n,this.toErrorObservable(e,"connection")).pipe(o.first()).subscribe(function(e){t.database.next(e.target.result)},function(e){t.database.error(e)})},n.prototype.transaction=function(t){var e=this;return void 0===t&&(t="readonly"),this.database.pipe(o.map(function(r){return r.transaction([e.objectStoreName],t).objectStore(e.objectStoreName)}))},n.prototype.toSuccessObservable=function(t){return r.fromEvent(t,"success").pipe(o.map(function(){return!0}))},n.prototype.toErrorObservable=function(t,e){return void 0===e&&(e=""),r.fromEvent(t,"error").pipe(o.mergeMap(function(o){return r.throwError(new Error("IndexedDB "+e+" issue : "+t.error.message+"."))}))},n.decorators=[{type:e.Injectable}],n.ctorParameters=function(){return[]},n}(i),p=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),c=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.localStorage=localStorage,e}return p(o,t),o.prototype.getItem=function(t){var e=this.localStorage.getItem(t),o=null;if(null!=e)try{o=JSON.parse(e)}catch(t){return r.throwError(new Error("Invalid data in localStorage."))}return r.of(o)},o.prototype.setItem=function(t,e){return this.localStorage.setItem(t,JSON.stringify(e)),r.of(!0)},o.prototype.removeItem=function(t){return this.localStorage.removeItem(t),r.of(!0)},o.prototype.clear=function(){return this.localStorage.clear(),r.of(!0)},o.decorators=[{type:e.Injectable}],o}(i),f=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),l=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.localStorage=new Map,e}return f(o,t),o.prototype.getItem=function(t){var e=this.localStorage.get(t);return r.of(void 0!==e?e:null)},o.prototype.setItem=function(t,e){return this.localStorage.set(t,e),r.of(!0)},o.prototype.removeItem=function(t){return this.localStorage.delete(t),r.of(!0)},o.prototype.clear=function(){return this.localStorage.clear(),r.of(!0)},o.decorators=[{type:e.Injectable}],o}(i),y=function(){function t(){this.simpleTypes=["string","number","boolean","object"]}return t.prototype.isObjectNotNull=function(t){return null!==t&&"object"==typeof t},t.prototype.validate=function(t,e){if(!this.isObjectNotNull(e))throw new Error("A schema must be an object (unlike spec, booleans are not supported to enforce strict types).");if(!(e.hasOwnProperty("type")&&"array"!==e.type&&"object"!==e.type||e.hasOwnProperty("properties")||e.hasOwnProperty("items")))throw new Error("Each value must have a 'type' or 'properties' or 'items', to enforce strict types.");if(e.hasOwnProperty("type")&&!this.validateType(t,e))return!1;if(e.hasOwnProperty("items")&&!this.validateItems(t,e))return!1;if(e.hasOwnProperty("properties")){if(e.hasOwnProperty("required")&&!this.validateRequired(t,e))return!1;if(!this.validateProperties(t,e))return!1}return!0},t.prototype.validateProperties=function(t,e){if(!this.isObjectNotNull(t))return!1;if(!e.properties||!this.isObjectNotNull(e.properties))throw new Error("'properties' must be a schema object.");if(Object.keys(e.properties).length!==Object.keys(t).length)return!1;for(var r in e.properties)if(e.properties.hasOwnProperty(r)&&t.hasOwnProperty(r)&&!this.validate(t[r],e.properties[r]))return!1;return!0},t.prototype.validateRequired=function(t,e){if(!this.isObjectNotNull(t))return!1;if(!Array.isArray(e.required))throw new Error("'required' field must be an array. Note that since JSON Schema draft 6, booleans are not supported anymore.");for(var r=0,o=e.required;r<o.length;r++){var n=o[r];if("string"!=typeof n)throw new Error("'required' array must contain strings only.");if(!e.properties||!e.properties.hasOwnProperty(n))throw new Error("'required' properties must be described in 'properties' too.");if(!t.hasOwnProperty(n))return!1}return!0},t.prototype.validateType=function(t,e){if(Array.isArray(e.type))return this.validateTypeList(t,e);if("string"!=typeof e.type)throw new Error("'type' must be a string (arrays of types are not supported yet).");return("null"!==e.type||null===t)&&((-1===this.simpleTypes.indexOf(e.type)||typeof t===e.type)&&!!("integer"!==e.type||"number"==typeof t&&Number.isInteger(t)))},t.prototype.validateTypeList=function(t,e){for(var r=[],o=0,n=e.type;o<n.length;o++){var a=n[o];r.push(this.validateType(t,{type:a}))}return-1!==r.indexOf(!0)},t.prototype.validateItems=function(t,e){if(!Array.isArray(t))return!1;if(Array.isArray(e.items))return this.validateItemsList(t,e);if(!e.items||!this.isObjectNotNull(e.items))throw new Error("'items' must be a schema object.");for(var r=0,o=t;r<o.length;r++){var n=o[r];if(!this.validate(n,e.items))return!1}return!0},t.prototype.validateItemsList=function(t,e){var r=e.items;if(t.length!==r.length)return!1;for(var o=0;o<r.length;o+=1)if(!this.validate(t[o],r[o]))return!1;return!0},t}(),h=function(){function t(t,e){this.database=t,this.jsonValidator=e,this.getItemOptionsDefault={schema:null}}return t.prototype.getItem=function(t,e){var n=this;return void 0===e&&(e=this.getItemOptionsDefault),this.database.getItem(t).pipe(o.mergeMap(function(t){if(e.schema&&null!==t){var o=!0;try{o=n.jsonValidator.validate(t,e.schema)}catch(t){return r.throwError(t)}if(!o)return r.throwError(new Error("JSON invalid"))}return r.of(t)}))},t.prototype.setItem=function(t,e){return this.database.setItem(t,e)},t.prototype.removeItem=function(t){return this.database.removeItem(t)},t.prototype.clear=function(){return this.database.clear()},t.prototype.setItemSubscribe=function(t,e){this.setItem(t,e).subscribe(function(){},function(){})},t.prototype.removeItemSubscribe=function(t){this.removeItem(t).subscribe(function(){},function(){})},t.prototype.clearSubscribe=function(){this.clear().subscribe(function(){},function(){})},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:i},{type:y}]},t}(),d=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{providers:[y,{provide:i,useFactory:a,deps:[e.PLATFORM_ID]},h]}]}],t}();t.LocalDatabase=i,t.IndexedDBDatabase=u,t.LocalStorageDatabase=c,t.MockLocalDatabase=l,t.JSONValidator=y,t.LocalStorage=h,t.LocalStorageModule=d,t.ɵa=a,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=local-storage.umd.min.js.map |
@@ -880,3 +880,3 @@ import { Injectable, NgModule, PLATFORM_ID } from '@angular/core'; | ||
*/ | ||
LocalStorage.prototype.setItemAndSubscribe = /** | ||
LocalStorage.prototype.setItemSubscribe = /** | ||
* Sets an item in local storage, and auto-subscribes | ||
@@ -899,3 +899,3 @@ * @param {?} key The item's key | ||
*/ | ||
LocalStorage.prototype.removeItemAndSubscribe = /** | ||
LocalStorage.prototype.removeItemSubscribe = /** | ||
* Deletes an item in local storage, and auto-subscribes | ||
@@ -913,3 +913,3 @@ * @param {?} key The item's key | ||
*/ | ||
LocalStorage.prototype.clearAndSubscribe = /** | ||
LocalStorage.prototype.clearSubscribe = /** | ||
* Deletes all items from local storage, and auto-subscribes | ||
@@ -916,0 +916,0 @@ * @return {?} |
@@ -569,3 +569,3 @@ import { Injectable, NgModule, PLATFORM_ID } from '@angular/core'; | ||
*/ | ||
setItemAndSubscribe(key, data) { | ||
setItemSubscribe(key, data) { | ||
this.setItem(key, data).subscribe(() => { }, () => { }); | ||
@@ -578,3 +578,3 @@ } | ||
*/ | ||
removeItemAndSubscribe(key) { | ||
removeItemSubscribe(key) { | ||
this.removeItem(key).subscribe(() => { }, () => { }); | ||
@@ -586,3 +586,3 @@ } | ||
*/ | ||
clearAndSubscribe() { | ||
clearSubscribe() { | ||
this.clear().subscribe(() => { }, () => { }); | ||
@@ -589,0 +589,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"JSONSchema":{"__symbolic":"interface"},"JSONSchemaType":{"__symbolic":"interface"},"LocalDatabase":{"__symbolic":"class","members":{"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}]}},"IndexedDBDatabase":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"LocalDatabase"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"transaction":[{"__symbolic":"method"}],"toSuccessObservable":[{"__symbolic":"method"}],"toErrorObservable":[{"__symbolic":"method"}]}},"LocalStorageDatabase":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"LocalDatabase"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}]}},"MockLocalDatabase":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"LocalDatabase"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}]}},"JSONValidator":{"__symbolic":"class","members":{"isObjectNotNull":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"validateProperties":[{"__symbolic":"method"}],"validateRequired":[{"__symbolic":"method"}],"validateType":[{"__symbolic":"method"}],"validateTypeList":[{"__symbolic":"method"}],"validateItems":[{"__symbolic":"method"}],"validateItemsList":[{"__symbolic":"method"}]}},"LSGetItemOptions":{"__symbolic":"interface"},"LocalStorage":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":12,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"LocalDatabase"},{"__symbolic":"reference","name":"JSONValidator"}]}],"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"setItemAndSubscribe":[{"__symbolic":"method"}],"removeItemAndSubscribe":[{"__symbolic":"method"}],"clearAndSubscribe":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"function"},"LocalStorageModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":31,"character":1},"arguments":[{"providers":[{"__symbolic":"reference","name":"JSONValidator"},{"provide":{"__symbolic":"reference","name":"LocalDatabase"},"useFactory":{"__symbolic":"reference","name":"ɵa"},"deps":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":37,"character":13}]},{"__symbolic":"reference","name":"LocalStorage"}]}]}],"members":{}}},"origins":{"JSONSchema":"./src/service/validation/json-schema","JSONSchemaType":"./src/service/validation/json-schema","LocalDatabase":"./src/service/databases/local-database","IndexedDBDatabase":"./src/service/databases/indexeddb-database","LocalStorageDatabase":"./src/service/databases/localstorage-database","MockLocalDatabase":"./src/service/databases/mock-local-database","JSONValidator":"./src/service/validation/json-validator","LSGetItemOptions":"./src/service/lib.service","LocalStorage":"./src/service/lib.service","ɵa":"./src/module","LocalStorageModule":"./src/module"},"importAs":"@ngx-pwa/local-storage"} | ||
{"__symbolic":"module","version":4,"metadata":{"JSONSchema":{"__symbolic":"interface"},"JSONSchemaType":{"__symbolic":"interface"},"LocalDatabase":{"__symbolic":"class","members":{"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}]}},"IndexedDBDatabase":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"LocalDatabase"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"transaction":[{"__symbolic":"method"}],"toSuccessObservable":[{"__symbolic":"method"}],"toErrorObservable":[{"__symbolic":"method"}]}},"LocalStorageDatabase":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"LocalDatabase"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}]}},"MockLocalDatabase":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"LocalDatabase"},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":6,"character":1}}],"members":{"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}]}},"JSONValidator":{"__symbolic":"class","members":{"isObjectNotNull":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"validateProperties":[{"__symbolic":"method"}],"validateRequired":[{"__symbolic":"method"}],"validateType":[{"__symbolic":"method"}],"validateTypeList":[{"__symbolic":"method"}],"validateItems":[{"__symbolic":"method"}],"validateItemsList":[{"__symbolic":"method"}]}},"LSGetItemOptions":{"__symbolic":"interface"},"LocalStorage":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":12,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"LocalDatabase"},{"__symbolic":"reference","name":"JSONValidator"}]}],"getItem":[{"__symbolic":"method"}],"setItem":[{"__symbolic":"method"}],"removeItem":[{"__symbolic":"method"}],"clear":[{"__symbolic":"method"}],"setItemSubscribe":[{"__symbolic":"method"}],"removeItemSubscribe":[{"__symbolic":"method"}],"clearSubscribe":[{"__symbolic":"method"}]}},"ɵa":{"__symbolic":"function"},"LocalStorageModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":31,"character":1},"arguments":[{"providers":[{"__symbolic":"reference","name":"JSONValidator"},{"provide":{"__symbolic":"reference","name":"LocalDatabase"},"useFactory":{"__symbolic":"reference","name":"ɵa"},"deps":[{"__symbolic":"reference","module":"@angular/core","name":"PLATFORM_ID","line":37,"character":13}]},{"__symbolic":"reference","name":"LocalStorage"}]}]}],"members":{}}},"origins":{"JSONSchema":"./src/service/validation/json-schema","JSONSchemaType":"./src/service/validation/json-schema","LocalDatabase":"./src/service/databases/local-database","IndexedDBDatabase":"./src/service/databases/indexeddb-database","LocalStorageDatabase":"./src/service/databases/localstorage-database","MockLocalDatabase":"./src/service/databases/mock-local-database","JSONValidator":"./src/service/validation/json-validator","LSGetItemOptions":"./src/service/lib.service","LocalStorage":"./src/service/lib.service","ɵa":"./src/module","LocalStorageModule":"./src/module"},"importAs":"@ngx-pwa/local-storage"} |
{ | ||
"name": "@ngx-pwa/local-storage", | ||
"version": "6.0.0-beta.2", | ||
"version": "6.0.0-beta.3", | ||
"description": "Efficient local storage module for Angular apps and PWA: simple API based on native localStorage API, but internally stored via the asynchronous IndexedDB API for performance, and wrapped in RxJS observables to be homogeneous with other Angular modules.", | ||
@@ -5,0 +5,0 @@ "main": "./bundles/local-storage.umd.js", |
@@ -47,5 +47,2 @@ # Async local storage for Angular | ||
```bash | ||
# For Angular 6 (next): | ||
npm install @ngx-pwa/local-storage@next | ||
# For Angular 5 (latest): | ||
@@ -56,2 +53,5 @@ npm install @ngx-pwa/local-storage | ||
npm install @ngx-pwa/local-storage@4 | ||
# For Angular 6 (next): | ||
npm install @ngx-pwa/local-storage@next | ||
``` | ||
@@ -170,11 +170,11 @@ | ||
Since *version 6*, you can use these methods to auto-subscribe: | ||
Since *version 5.2*, you can use these methods to auto-subscribe: | ||
```typescript | ||
this.localStorage.setItemAndSubscribe('user', user); | ||
this.localStorage.removeItemAndSubscribe('user'); | ||
this.localStorage.clearAndSubscribe(); | ||
this.localStorage.setItemSubscribe('user', user); | ||
this.localStorage.removeItemSubscribe('user'); | ||
this.localStorage.clearSubscribe(); | ||
``` | ||
*Do this **only** if these conditions are fulfilled:* | ||
*Use these methods **only** if these conditions are fulfilled:* | ||
- you don't need to manage the error callback (with these methods, errors will silently fail), | ||
@@ -181,0 +181,0 @@ - you don't need to wait the operation to finish before the next one (remember, it's asynchronous). |
@@ -44,3 +44,3 @@ import { Observable } from 'rxjs'; | ||
*/ | ||
setItemAndSubscribe(key: string, data: any): void; | ||
setItemSubscribe(key: string, data: any): void; | ||
/** | ||
@@ -50,5 +50,5 @@ * Deletes an item in local storage, and auto-subscribes | ||
*/ | ||
removeItemAndSubscribe(key: string): void; | ||
removeItemSubscribe(key: string): void; | ||
/** Deletes all items from local storage, and auto-subscribes */ | ||
clearAndSubscribe(): void; | ||
clearSubscribe(): void; | ||
} |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
272920