add LocalStorage plugin

This commit is contained in:
Matias Alejo Garcia 2014-09-01 23:44:35 -03:00
commit b9881c1147
10 changed files with 101 additions and 16 deletions

View file

@ -5,7 +5,38 @@ function GoogleDrive() {
};
GoogleDrive.prototype.init = function() {
console.log('[googleDrive.js.3] init'); //TODO
console.log('[googleDrive.js.3] init GoogleDrive'); //TODO
};
GoogleDrive.prototype.getItem = function(k) {
return localStorage.getItem(k);
};
GoogleDrive.prototype.setItem = function(k,v) {
localStorage.setItem(k,v);
};
GoogleDrive.prototype.removeItem = function(k) {
localStorage.removeItem(k);
};
GoogleDrive.prototype.clear = function() {
localStorage.clear();
};
delete GoogleDrive.prototype.length;
Object.defineProperty(GoogleDrive.prototype, 'length', {
get: function() {
return localStorage.length;
}
});
GoogleDrive.prototype.key = function(k) {
var v = localStorage.key(k);
return v;
};
module.exports = GoogleDrive;