Comparing version 0.3.5 to 0.3.6
@@ -53,4 +53,17 @@ (function(angular, factory) { | ||
function isStorageSupported(storageType) { | ||
var supported = $window[storageType]; | ||
// Some installations of IE, for an unknown reason, throw "SCRIPT5: Error: Access is denied" | ||
// when accessing window.localStorage. This happens before you try to do anything with it. Catch | ||
// that error and allow execution to continue. | ||
// fix 'SecurityError: DOM Exception 18' exception in Desktop Safari, Mobile Safari | ||
// when "Block cookies": "Always block" is turned on | ||
var supported; | ||
try { | ||
supported = $window[storageType]; | ||
} | ||
catch (err) { | ||
supported = false; | ||
} | ||
// When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage | ||
@@ -57,0 +70,0 @@ // is available, but trying to call .setItem throws an exception below: |
@@ -1,1 +0,1 @@ | ||
/*! ngstorage 0.3.4 | Copyright (c) 2015 Gias Kay Lee | MIT License */!function(a,b){"use strict";return"function"==typeof define&&define.amd?void define("ngStorage",["angular"],function(a){return b(a)}):b(a)}("undefined"==typeof angular?null:angular,function(a){"use strict";function b(b){return["$rootScope","$window","$log","$timeout",function(c,d,e,f){function g(a){var b=d[a];if(b&&"localStorage"===a){var c="__"+Math.round(1e7*Math.random());try{localStorage.setItem(c,c),localStorage.removeItem(c)}catch(e){b=!1}}return b}var h,i,j=g(b)||(e.warn("This browser does not support Web Storage!"),{setItem:function(){},getItem:function(){}}),k={$default:function(b){for(var c in b)a.isDefined(k[c])||(k[c]=b[c]);return k},$reset:function(a){for(var b in k)"$"===b[0]||delete k[b]&&j.removeItem("ngStorage-"+b);return k.$default(a)}};try{j=d[b],j.length}catch(l){e.warn("This browser does not support Web Storage!"),j={}}for(var m,n=0,o=j.length;o>n;n++)(m=j.key(n))&&"ngStorage-"===m.slice(0,10)&&(k[m.slice(10)]=a.fromJson(j.getItem(m)));return h=a.copy(k),c.$watch(function(){var b;i||(i=f(function(){if(i=null,!a.equals(k,h)){b=a.copy(h),a.forEach(k,function(c,d){a.isDefined(c)&&"$"!==d[0]&&j.setItem("ngStorage-"+d,a.toJson(c)),delete b[d]});for(var c in b)j.removeItem("ngStorage-"+c);h=a.copy(k)}},100,!1))}),"localStorage"===b&&d.addEventListener&&d.addEventListener("storage",function(b){"ngStorage-"===b.key.slice(0,10)&&(b.newValue?k[b.key.slice(10)]=a.fromJson(b.newValue):delete k[b.key.slice(10)],h=a.copy(k),c.$apply())}),k}]}a.module("ngStorage",[]).factory("$localStorage",b("localStorage")).factory("$sessionStorage",b("sessionStorage"))}); | ||
/*! ngstorage 0.3.6 | Copyright (c) 2015 Gias Kay Lee | MIT License */!function(a,b){"use strict";return"function"==typeof define&&define.amd?void define("ngStorage",["angular"],function(a){return b(a)}):b(a)}("undefined"==typeof angular?null:angular,function(a){"use strict";function b(b){return["$rootScope","$window","$log","$timeout",function(c,d,e,f){function g(a){var b;try{b=d[a]}catch(c){b=!1}if(b&&"localStorage"===a){var e="__"+Math.round(1e7*Math.random());try{localStorage.setItem(e,e),localStorage.removeItem(e)}catch(c){b=!1}}return b}var h,i,j=g(b)||(e.warn("This browser does not support Web Storage!"),{setItem:function(){},getItem:function(){}}),k={$default:function(b){for(var c in b)a.isDefined(k[c])||(k[c]=b[c]);return k},$reset:function(a){for(var b in k)"$"===b[0]||delete k[b]&&j.removeItem("ngStorage-"+b);return k.$default(a)}};try{j=d[b],j.length}catch(l){e.warn("This browser does not support Web Storage!"),j={}}for(var m,n=0,o=j.length;o>n;n++)(m=j.key(n))&&"ngStorage-"===m.slice(0,10)&&(k[m.slice(10)]=a.fromJson(j.getItem(m)));return h=a.copy(k),c.$watch(function(){var b;i||(i=f(function(){if(i=null,!a.equals(k,h)){b=a.copy(h),a.forEach(k,function(c,d){a.isDefined(c)&&"$"!==d[0]&&j.setItem("ngStorage-"+d,a.toJson(c)),delete b[d]});for(var c in b)j.removeItem("ngStorage-"+c);h=a.copy(k)}},100,!1))}),"localStorage"===b&&d.addEventListener&&d.addEventListener("storage",function(b){"ngStorage-"===b.key.slice(0,10)&&(b.newValue?k[b.key.slice(10)]=a.fromJson(b.newValue):delete k[b.key.slice(10)],h=a.copy(k),c.$apply())}),k}]}a.module("ngStorage",[]).factory("$localStorage",b("localStorage")).factory("$sessionStorage",b("sessionStorage"))}); |
{ | ||
"name": "ngstorage", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"author": "Gias Kay Lee", | ||
@@ -5,0 +5,0 @@ "licenses": [ |
@@ -26,2 +26,4 @@ ngStorage | ||
### Bower | ||
```bash | ||
@@ -31,2 +33,22 @@ bower install ngstorage | ||
*NOTE:* We are `ngstorage` and *NOT* `ngStorage`. The casing is important! | ||
### NPM | ||
```bash | ||
npm install ngstorage | ||
``` | ||
*NOTE:* We are `ngstorage` and *NOT* `ngStorage`. The casing is important! | ||
CDN | ||
=== | ||
cdnjs now hosts ngStorage at <https://cdnjs.com/libraries/ngStorage> | ||
To use it | ||
``` html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ngStorage/0.3.5/ngStorage.min.js"></script> | ||
``` | ||
Usage | ||
@@ -33,0 +55,0 @@ ===== |
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
16268
130
160