angular-storage
Advanced tools
Comparing version 0.0.11 to 0.0.12
{ | ||
"name": "a0-angular-storage", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ { |
@@ -86,13 +86,12 @@ (function() { | ||
.service('localStorage', ["$window", "$injector", function ($window, $injector) { | ||
var localStorageAvailable = !!$window.localStorage; | ||
var localStorageAvailable; | ||
if (localStorageAvailable) { | ||
try { | ||
$window.localStorage.setItem('testKey', 'test'); | ||
$window.localStorage.removeItem('testKey'); | ||
localStorageAvailable = true; | ||
} catch(e) { | ||
localStorageAvailable = false; | ||
} | ||
try { | ||
$window.localStorage.setItem('testKey', 'test'); | ||
$window.localStorage.removeItem('testKey'); | ||
localStorageAvailable = true; | ||
} catch(e) { | ||
localStorageAvailable = false; | ||
} | ||
if (localStorageAvailable) { | ||
@@ -99,0 +98,0 @@ this.set = function (what, value) { |
@@ -1,1 +0,1 @@ | ||
!function(){angular.module("angular-storage",["angular-storage.store"]),angular.module("angular-storage.cookieStorage",[]).service("cookieStorage",["$injector",function(e){var t=e.get("$cookieStore");this.set=function(e,r){return t.put(e,r)},this.get=function(e){return t.get(e)},this.remove=function(e){return t.remove(e)}}]),angular.module("angular-storage.internalStore",["angular-storage.localStorage","angular-storage.sessionStorage"]).factory("InternalStore",["$log","$injector",function(e,t){function r(e,r,o){this.namespace=e||null,this.delimiter=o||".",this.inMemoryCache={},this.storage=t.get(r||"localStorage")}return r.prototype.getNamespacedKey=function(e){return this.namespace?[this.namespace,e].join(this.delimiter):e},r.prototype.set=function(e,t){this.inMemoryCache[e]=t,this.storage.set(this.getNamespacedKey(e),JSON.stringify(t))},r.prototype.get=function(t){var r=null;if(t in this.inMemoryCache)return this.inMemoryCache[t];var o=this.storage.get(this.getNamespacedKey(t));try{r="undefined"==typeof o||"undefined"===o?void 0:JSON.parse(o),this.inMemoryCache[t]=r}catch(a){e.error("Error parsing saved value",a),this.remove(t)}return r},r.prototype.remove=function(e){this.inMemoryCache[e]=null,this.storage.remove(this.getNamespacedKey(e))},r}]),angular.module("angular-storage.localStorage",["angular-storage.cookieStorage"]).service("localStorage",["$window","$injector",function(e,t){var r=!!e.localStorage;if(r)try{e.localStorage.setItem("testKey","test"),e.localStorage.removeItem("testKey"),r=!0}catch(o){r=!1}if(r)this.set=function(t,r){return e.localStorage.setItem(t,r)},this.get=function(t){return e.localStorage.getItem(t)},this.remove=function(t){return e.localStorage.removeItem(t)};else{var a=t.get("cookieStorage");this.set=a.set,this.get=a.get,this.remove=a.remove}}]),angular.module("angular-storage.sessionStorage",["angular-storage.cookieStorage"]).service("sessionStorage",["$window","$injector",function(e,t){if(e.sessionStorage)this.set=function(t,r){return e.sessionStorage.setItem(t,r)},this.get=function(t){return e.sessionStorage.getItem(t)},this.remove=function(t){return e.sessionStorage.removeItem(t)};else{var r=t.get("cookieStorage");this.set=r.set,this.get=r.get,this.remove=r.remove}}]),angular.module("angular-storage.store",["angular-storage.internalStore"]).provider("store",function(){var e="localStorage";this.setStore=function(t){t&&angular.isString(t)&&(e=t)},this.$get=["InternalStore",function(t){var r=new t(null,e);return r.getNamespacedStore=function(e,r,o){return new t(e,r,o)},r}]})}(); | ||
!function(){angular.module("angular-storage",["angular-storage.store"]),angular.module("angular-storage.cookieStorage",[]).service("cookieStorage",["$injector",function(e){var t=e.get("$cookieStore");this.set=function(e,r){return t.put(e,r)},this.get=function(e){return t.get(e)},this.remove=function(e){return t.remove(e)}}]),angular.module("angular-storage.internalStore",["angular-storage.localStorage","angular-storage.sessionStorage"]).factory("InternalStore",["$log","$injector",function(e,t){function r(e,r,o){this.namespace=e||null,this.delimiter=o||".",this.inMemoryCache={},this.storage=t.get(r||"localStorage")}return r.prototype.getNamespacedKey=function(e){return this.namespace?[this.namespace,e].join(this.delimiter):e},r.prototype.set=function(e,t){this.inMemoryCache[e]=t,this.storage.set(this.getNamespacedKey(e),JSON.stringify(t))},r.prototype.get=function(t){var r=null;if(t in this.inMemoryCache)return this.inMemoryCache[t];var o=this.storage.get(this.getNamespacedKey(t));try{r="undefined"==typeof o||"undefined"===o?void 0:JSON.parse(o),this.inMemoryCache[t]=r}catch(a){e.error("Error parsing saved value",a),this.remove(t)}return r},r.prototype.remove=function(e){this.inMemoryCache[e]=null,this.storage.remove(this.getNamespacedKey(e))},r}]),angular.module("angular-storage.localStorage",["angular-storage.cookieStorage"]).service("localStorage",["$window","$injector",function(e,t){var r;try{e.localStorage.setItem("testKey","test"),e.localStorage.removeItem("testKey"),r=!0}catch(o){r=!1}if(r)this.set=function(t,r){return e.localStorage.setItem(t,r)},this.get=function(t){return e.localStorage.getItem(t)},this.remove=function(t){return e.localStorage.removeItem(t)};else{var a=t.get("cookieStorage");this.set=a.set,this.get=a.get,this.remove=a.remove}}]),angular.module("angular-storage.sessionStorage",["angular-storage.cookieStorage"]).service("sessionStorage",["$window","$injector",function(e,t){if(e.sessionStorage)this.set=function(t,r){return e.sessionStorage.setItem(t,r)},this.get=function(t){return e.sessionStorage.getItem(t)},this.remove=function(t){return e.sessionStorage.removeItem(t)};else{var r=t.get("cookieStorage");this.set=r.set,this.get=r.get,this.remove=r.remove}}]),angular.module("angular-storage.store",["angular-storage.internalStore"]).provider("store",function(){var e="localStorage";this.setStore=function(t){t&&angular.isString(t)&&(e=t)},this.$get=["InternalStore",function(t){var r=new t(null,e);return r.getNamespacedStore=function(e,r,o){return new t(e,r,o)},r}]})}(); |
0.0.12 / 2015-07-22 | ||
=================== | ||
* Merge pull request #36 from jercoh/detect-sessionStorage | ||
* fix(sessionStorage): proper detect sessionStorage | ||
* Merge pull request #31 from ako977/master | ||
* Fix for #30: Proper handling of localStorage disabled check | ||
0.0.11 / 2015-05-18 | ||
@@ -3,0 +11,0 @@ =================== |
{ | ||
"name": "angular-storage", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"main": "index.js", | ||
@@ -17,3 +17,3 @@ "author": { | ||
"chai-jquery": "^1.2.3", | ||
"gulp": "^3.8.11", | ||
"gulp": "^3.9.0", | ||
"gulp-concat": "^2.3.4", | ||
@@ -20,0 +20,0 @@ "gulp-jshint": "^1.9.2", |
angular.module('angular-storage.localStorage', ['angular-storage.cookieStorage']) | ||
.service('localStorage', function ($window, $injector) { | ||
var localStorageAvailable = !!$window.localStorage; | ||
var localStorageAvailable; | ||
if (localStorageAvailable) { | ||
try { | ||
$window.localStorage.setItem('testKey', 'test'); | ||
$window.localStorage.removeItem('testKey'); | ||
localStorageAvailable = true; | ||
} catch(e) { | ||
localStorageAvailable = false; | ||
} | ||
try { | ||
$window.localStorage.setItem('testKey', 'test'); | ||
$window.localStorage.removeItem('testKey'); | ||
localStorageAvailable = true; | ||
} catch(e) { | ||
localStorageAvailable = false; | ||
} | ||
if (localStorageAvailable) { | ||
@@ -15,0 +14,0 @@ this.set = function (what, value) { |
angular.module('angular-storage.sessionStorage', ['angular-storage.cookieStorage']) | ||
.service('sessionStorage', function ($window, $injector) { | ||
if ($window.sessionStorage) { | ||
var sessionStorageAvailable; | ||
try { | ||
$window.sessionStorage.setItem('testKey', 'test'); | ||
$window.sessionStorage.removeItem('testKey'); | ||
sessionStorageAvailable = true; | ||
} catch(e) { | ||
sessionStorageAvailable = false; | ||
} | ||
if (sessionStorageAvailable) { | ||
this.set = function (what, value) { | ||
@@ -5,0 +15,0 @@ return $window.sessionStorage.setItem(what, value); |
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
47970
1042