Add base for handling and storing progress

This commit is contained in:
Samy Pessé
2014-03-31 19:34:48 -07:00
parent 0ad6533f12
commit 07c10da91f
6 changed files with 6872 additions and 3 deletions
+20
View File
@@ -0,0 +1,20 @@
define(function(){
/*
* Simple module for storing data in the browser's local storage
*/
return {
set: function(key, value) {
localStorage[key] = JSON.stringify(value);
},
get: function(key, def) {
try {
return JSON.parse(localStorage[key]) || def;
} catch(err) {
return localStorage[key] || def;
}
},
remove: function(key) {
localStorage.removeItem(key);
}
};
});