more helpers in common

pull/1/head
ansuz 8 years ago
parent 70f8837681
commit e84fbf0bc3

@ -71,6 +71,20 @@ define([
}); });
}; };
var getHash = common.getHash = function () {
return window.location.hash.slice(1);
};
var setPadAttribute = common.setPadAttribute = function (attr, value) {
var hash = getHash();
localStorage.setItem([getHash(),attr].join('.'), value);
return value;
};
var getPadAttribute = common.getPadAttribute = function (attr) {
return localStorage.getItem([getHash(),attr].join('.'));
};
/* fetch and migrate your pad history from localStorage */ /* fetch and migrate your pad history from localStorage */
var getRecentPads = common.getRecentPads = function () { var getRecentPads = common.getRecentPads = function () {
var recentPadsStr = localStorage[storageKey]; var recentPadsStr = localStorage[storageKey];

Loading…
Cancel
Save