mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-01 20:22:29 +00:00
feature(dom) saveDataToCache: add Cache.get
This commit is contained in:
parent
9e36587f7a
commit
444eb6041e
1 changed files with 15 additions and 10 deletions
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue