-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstorage.min.js
2 lines (2 loc) · 1.08 KB
/
storage.min.js
1
2
var Storage=window.Storage||{};if(!Date.now){Date.now=function(){return(new Date).getTime()}}var Storage=function(e){if(typeof e===typeof undefined)var n="storage";else var n=e;var t=null;function r(e){if(t===null)i();if(typeof t[e]===typeof undefined)return null;return t[e]}function u(e){if(t===null)i();if(typeof t[e]===typeof undefined)return false;return true}function o(e,n){if(t===null)i();t[e]=n;l();return true}function f(e){if(t===null)i();if(typeof t[e]===typeof undefined)return false;delete t[e];l();return true}function i(){if(!a())return{};if(!window["localStorage"])return{};var e=window["localStorage"];var r=e.getItem(n);t=JSON.parse(r)||{}}function a(){try{return"localStorage"in window&&window["localStorage"]!==null}catch(e){return false}}function l(){var e=JSON.stringify(t);if(!a())return false;if(!window["localStorage"])return false;var r=window["localStorage"];r.setItem(n,e)}function c(){}c();return{getValue:function(e){return r(e)},hasValue:function(e){return u(e)},setValue:function(e,n){return o(e,n)},removeValue:function(e){return f(e)}}};
//# sourceMappingURL=storage.js.map