Posted By

cmndo on 05/29/11


Tagged

javascript data safari mobile local storage phonegap


Versions (?)

Local Storage HTML5 Wrapper


 / Published in: JavaScript
 

URL: www.digitalsurgeons.com

  1. /*
  2.  * This Datalton object can be used to store strings or objects.
  3.  */
  4. var Datalton = function(){
  5. //private code
  6. if (typeof(localStorage) == 'undefined' ) {
  7. return false;
  8. }
  9. //public
  10. return {
  11. set:function(prop, val){
  12. localStorage.setItem(prop, JSON.stringify(val));
  13. },
  14. get:function(prop){
  15. return JSON.parse(localStorage.getItem(prop));
  16. },
  17. remove:function(prop){
  18. localStorage.removeItem(prop);
  19. }
  20. }
  21. }();

Report this snippet  

You need to login to post a comment.