feature(dom) saveDataToCache: add Cache.get

This commit is contained in:
coderaiser 2013-11-19 12:27:25 +00:00
parent 9e36587f7a
commit 444eb6041e

View file

@ -1758,20 +1758,25 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
*/
this.saveDataToCache = function(name, data, callback) {
CloudCmd.getConfig(function(config) {
var allowed = config.localStorage;
var cacheName,
allowed = config.localStorage;
if (!allowed)
Util.exec(callback);
else {
Cache.set(name + '-data', data);
DOM.loadCurrentHash(function(hash) {
var isContain = Util.isContainStr(hash, 'error');
if (!isContain)
Cache.set(name + '-hash', hash);
Util.exec(callback, hash);
});
cacheName = name + '-data';
if (!!Cache.get(cacheName)) {
Cache.set(cacheName, data);
DOM.loadCurrentHash(function(hash) {
var isContain = Util.isContainStr(hash, 'error');
if (!isContain)
Cache.set(name + '-hash', hash);
Util.exec(callback, hash);
});
}
}
});
};