-
Notifications
You must be signed in to change notification settings - Fork 7
/
connectDb.min.js
1 lines (1 loc) · 1.05 KB
/
connectDb.min.js
1
!function(){_db={version:"0.1",date:"25/Nov/2013",checkBrowser:function(){return window.localStorage?!0:!1},isempty:function(){return 0==localStorage.length?!0:!1},isKey:function(a){return localStorage[a]?!0:!1},clear:function(){return localStorage.clear(),!0},createRow:function(a,b){localStorage[a]||localStorage.setItem(a,b)},getRow:function(a){return localStorage.getItem(a)},removeRow:function(a){localStorage.removeItem(a)},viewRow:function(){for(key in localStorage)console.log(localStorage[key])},setJSON:function(a,b){localStorage[a]||localStorage.setItem(a,JSON.stringify(b))},getJSON:function(a){return localStorage[a]?JSON.parse(localStorage[a]):!1},length:function(a){return JSON.parse(localStorage[a]).length},update:function(a,b){localStorage.clear(a),_db.setJSON(a,b)},createSecureRow:function(a,b){sessionStorage.setItem(a,b)},getSecureRow:function(a){return sessionStorage.getItem(a)},removeSecureRow:function(a){sessionStorage.removeItem(a)},keys:function(a){return Object.keys(a)},values:function(a){var b=[];for(var c in a)val.push(a[c]);return b}}}(window);