Skip to content

Instantly share code, notes, and snippets.

PrakarangS prakarangs

Block or report user

Report or block prakarangs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anhang
anhang / localStorage.js
Created Jul 20, 2011
HTML5 Local Storage with Expiration
View localStorage.js
AZHU.storage = {
save : function(key, jsonData, expirationMin){
if (!Modernizr.localstorage){return false;}
var expirationMS = expirationMin * 60 * 1000;
var record = {value: JSON.stringify(jsonData), timestamp: new Date().getTime() + expirationMS}
localStorage.setItem(key, JSON.stringify(record));
return jsonData;
},
load : function(key){
if (!Modernizr.localstorage){return false;}
You can’t perform that action at this time.