ngx-webstorage-service
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -205,17 +205,17 @@ (function (global, factory) { | ||
try { | ||
if ((typeof sessionStorage) === 'undefined' || !isStorageAvailable(sessionStorage)) { | ||
return new InMemoryStorageService(); | ||
if ((typeof sessionStorage) !== 'undefined' && isStorageAvailable(sessionStorage)) { | ||
return new WebStorageService(sessionStorage); | ||
} | ||
} | ||
catch (_a) { } | ||
return new WebStorageService(sessionStorage); | ||
return new InMemoryStorageService(); | ||
} | ||
function localStorageFactory() { | ||
try { | ||
if ((typeof localStorage) === 'undefined' || !isStorageAvailable(localStorage)) { | ||
return new InMemoryStorageService(); | ||
if ((typeof localStorage) !== 'undefined' && isStorageAvailable(localStorage)) { | ||
return new WebStorageService(localStorage); | ||
} | ||
} | ||
catch (_a) { } | ||
return new WebStorageService(localStorage); | ||
return new InMemoryStorageService(); | ||
} | ||
@@ -222,0 +222,0 @@ var StorageServiceModule = /** @class */ (function () { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ngx-webstorage-service",["exports","@angular/core"],t):t(e.ngxWebstorageService={},e.ng.core)}(this,function(e,t){"use strict";var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function n(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var r=function(){function t(e,t){this.defaultTranscoder=e,this.subject=t}return t.prototype.has=function(e){return this.subject.has(e)},t.prototype.get=function(e,t){return this.subject.get(e,t||this.defaultTranscoder)},t.prototype.set=function(e,t,r){this.subject.set(e,t,r||this.defaultTranscoder)},t.prototype.remove=function(e){this.subject.remove(e)},t.prototype.clear=function(){this.subject.clear()},t.prototype.withDefaultTranscoder=function(e){return new t(e,this.subject)},t}(),i=function(){function e(e){this.defaultTranscoder=e}return e.prototype.get=function(e,t){var r=this.getItem(e);return r!==undefined?(t||this.defaultTranscoder).decode(r):undefined},e.prototype.set=function(e,t,r){this.setItem(e,(r||this.defaultTranscoder).encode(t))},e.prototype.withDefaultTranscoder=function(e){return new r(e,this)},e}(),u=function(){function e(){}return e.prototype.encode=function(e){return JSON.stringify(e)},e.prototype.decode=function(e){try{return JSON.parse(e)}catch(t){return undefined}},e}(),c=function(){function e(){}return e.prototype.encode=function(e){return e},e.prototype.decode=function(e){return e},e}(),s=function(){function e(){}return e.prototype.encode=function(e){return e.toString()},e.prototype.decode=function(e){return"true"===e||"false"!==e&&undefined},e}(),a=function(){function e(){}return e.prototype.encode=function(e){return e.toString()},e.prototype.decode=function(e){var t=Number(e);return Number.isFinite(t)?t:undefined},e}(),f={JSON:new u,STRING:new c,BOOLEAN:new s,NUMBER:new a},p=function(t){function e(){var e=t.call(this,f.JSON)||this;return e.storage=new Map,e}return n(e,t),e.prototype.has=function(e){return this.storage.has(e)},e.prototype.remove=function(e){this.storage["delete"](e)},e.prototype.clear=function(){this.storage.clear()},e.prototype.getItem=function(e){return this.storage.has(e)?this.storage.get(e):undefined},e.prototype.setItem=function(e,t){this.storage.set(e,t)},e}(i),d=function(r){function e(e){var t=r.call(this,f.JSON)||this;return t.storage=e,t}return n(e,r),e.prototype.has=function(e){return null!==this.storage.getItem(e)},e.prototype.remove=function(e){this.storage.removeItem(e)},e.prototype.clear=function(){this.storage.clear()},e.prototype.getItem=function(e){var t=this.storage.getItem(e);return null!==t?t:undefined},e.prototype.setItem=function(e,t){return this.storage.setItem(e,t)},e}(i);function g(e){if(!e)return!1;try{var t=Date.now(),r="storage-test-entry-"+t,o="storage-test-value-"+t;e.setItem(r,o);var n=e.getItem(r);return e.removeItem(r),n===o}catch(i){return!1}}var y=new t.InjectionToken("SESSION_STORAGE"),h=new t.InjectionToken("LOCAL_STORAGE");function l(){try{if("undefined"==typeof sessionStorage||!g(sessionStorage))return new p}catch(e){}return new d(sessionStorage)}function S(){try{if("undefined"==typeof localStorage||!g(localStorage))return new p}catch(e){}return new d(localStorage)}var v=function(){};v.decorators=[{type:t.NgModule,args:[{providers:[{provide:y,useFactory:l},{provide:h,useFactory:S}]}]}],e.BaseStorageService=i,e.InMemoryStorageService=p,e.ProxyStorageService=r,e.JsonStorageTranscoder=u,e.StringStorageTranscoder=c,e.BooleanStorageTranscoder=s,e.NumberStorageTranscoder=a,e.StorageTranscoders=f,e.WebStorageService=d,e.isStorageAvailable=g,e.SESSION_STORAGE=y,e.LOCAL_STORAGE=h,e.sessionStorageFactory=l,e.localStorageFactory=S,e.StorageServiceModule=v,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ngx-webstorage-service",["exports","@angular/core"],t):t(e.ngxWebstorageService={},e.ng.core)}(this,function(e,t){"use strict";var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};function n(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var r=function(){function t(e,t){this.defaultTranscoder=e,this.subject=t}return t.prototype.has=function(e){return this.subject.has(e)},t.prototype.get=function(e,t){return this.subject.get(e,t||this.defaultTranscoder)},t.prototype.set=function(e,t,r){this.subject.set(e,t,r||this.defaultTranscoder)},t.prototype.remove=function(e){this.subject.remove(e)},t.prototype.clear=function(){this.subject.clear()},t.prototype.withDefaultTranscoder=function(e){return new t(e,this.subject)},t}(),i=function(){function e(e){this.defaultTranscoder=e}return e.prototype.get=function(e,t){var r=this.getItem(e);return r!==undefined?(t||this.defaultTranscoder).decode(r):undefined},e.prototype.set=function(e,t,r){this.setItem(e,(r||this.defaultTranscoder).encode(t))},e.prototype.withDefaultTranscoder=function(e){return new r(e,this)},e}(),u=function(){function e(){}return e.prototype.encode=function(e){return JSON.stringify(e)},e.prototype.decode=function(e){try{return JSON.parse(e)}catch(t){return undefined}},e}(),c=function(){function e(){}return e.prototype.encode=function(e){return e},e.prototype.decode=function(e){return e},e}(),s=function(){function e(){}return e.prototype.encode=function(e){return e.toString()},e.prototype.decode=function(e){return"true"===e||"false"!==e&&undefined},e}(),a=function(){function e(){}return e.prototype.encode=function(e){return e.toString()},e.prototype.decode=function(e){var t=Number(e);return Number.isFinite(t)?t:undefined},e}(),f={JSON:new u,STRING:new c,BOOLEAN:new s,NUMBER:new a},p=function(t){function e(){var e=t.call(this,f.JSON)||this;return e.storage=new Map,e}return n(e,t),e.prototype.has=function(e){return this.storage.has(e)},e.prototype.remove=function(e){this.storage["delete"](e)},e.prototype.clear=function(){this.storage.clear()},e.prototype.getItem=function(e){return this.storage.has(e)?this.storage.get(e):undefined},e.prototype.setItem=function(e,t){this.storage.set(e,t)},e}(i),d=function(r){function e(e){var t=r.call(this,f.JSON)||this;return t.storage=e,t}return n(e,r),e.prototype.has=function(e){return null!==this.storage.getItem(e)},e.prototype.remove=function(e){this.storage.removeItem(e)},e.prototype.clear=function(){this.storage.clear()},e.prototype.getItem=function(e){var t=this.storage.getItem(e);return null!==t?t:undefined},e.prototype.setItem=function(e,t){return this.storage.setItem(e,t)},e}(i);function g(e){if(!e)return!1;try{var t=Date.now(),r="storage-test-entry-"+t,o="storage-test-value-"+t;e.setItem(r,o);var n=e.getItem(r);return e.removeItem(r),n===o}catch(i){return!1}}var y=new t.InjectionToken("SESSION_STORAGE"),h=new t.InjectionToken("LOCAL_STORAGE");function l(){try{if("undefined"!=typeof sessionStorage&&g(sessionStorage))return new d(sessionStorage)}catch(e){}return new p}function S(){try{if("undefined"!=typeof localStorage&&g(localStorage))return new d(localStorage)}catch(e){}return new p}var v=function(){};v.decorators=[{type:t.NgModule,args:[{providers:[{provide:y,useFactory:l},{provide:h,useFactory:S}]}]}],e.BaseStorageService=i,e.InMemoryStorageService=p,e.ProxyStorageService=r,e.JsonStorageTranscoder=u,e.StringStorageTranscoder=c,e.BooleanStorageTranscoder=s,e.NumberStorageTranscoder=a,e.StorageTranscoders=f,e.WebStorageService=d,e.isStorageAvailable=g,e.SESSION_STORAGE=y,e.LOCAL_STORAGE=h,e.sessionStorageFactory=l,e.localStorageFactory=S,e.StorageServiceModule=v,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-webstorage-service.umd.min.js.map |
@@ -441,8 +441,8 @@ import { InjectionToken, NgModule } from '@angular/core'; | ||
try { | ||
if (/** @type {?} */ (typeof sessionStorage) === 'undefined' || !isStorageAvailable(sessionStorage)) { | ||
return new InMemoryStorageService(); | ||
if (/** @type {?} */ (typeof sessionStorage) !== 'undefined' && isStorageAvailable(sessionStorage)) { | ||
return new WebStorageService(sessionStorage); | ||
} | ||
} | ||
catch (_a) { } | ||
return new WebStorageService(sessionStorage); | ||
return new InMemoryStorageService(); | ||
} | ||
@@ -454,8 +454,8 @@ /** | ||
try { | ||
if (/** @type {?} */ (typeof localStorage) === 'undefined' || !isStorageAvailable(localStorage)) { | ||
return new InMemoryStorageService(); | ||
if (/** @type {?} */ (typeof localStorage) !== 'undefined' && isStorageAvailable(localStorage)) { | ||
return new WebStorageService(localStorage); | ||
} | ||
} | ||
catch (_a) { } | ||
return new WebStorageService(localStorage); | ||
return new InMemoryStorageService(); | ||
} | ||
@@ -462,0 +462,0 @@ class StorageServiceModule { |
@@ -180,17 +180,17 @@ import { __extends } from 'tslib'; | ||
try { | ||
if ((typeof sessionStorage) === 'undefined' || !isStorageAvailable(sessionStorage)) { | ||
return new InMemoryStorageService(); | ||
if ((typeof sessionStorage) !== 'undefined' && isStorageAvailable(sessionStorage)) { | ||
return new WebStorageService(sessionStorage); | ||
} | ||
} | ||
catch (_a) { } | ||
return new WebStorageService(sessionStorage); | ||
return new InMemoryStorageService(); | ||
} | ||
function localStorageFactory() { | ||
try { | ||
if ((typeof localStorage) === 'undefined' || !isStorageAvailable(localStorage)) { | ||
return new InMemoryStorageService(); | ||
if ((typeof localStorage) !== 'undefined' && isStorageAvailable(localStorage)) { | ||
return new WebStorageService(localStorage); | ||
} | ||
} | ||
catch (_a) { } | ||
return new WebStorageService(localStorage); | ||
return new InMemoryStorageService(); | ||
} | ||
@@ -197,0 +197,0 @@ var StorageServiceModule = /** @class */ (function () { |
{ | ||
"name": "ngx-webstorage-service", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "Angular5+ service wrappers for the webstorage API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/dscheerens/ngx-webstorage-service", |
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
203857