mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(files) add getTimeoutOnce
This commit is contained in:
parent
05f25e994e
commit
c39e343357
1 changed files with 22 additions and 1 deletions
|
|
@ -20,7 +20,8 @@
|
|||
funcs = [],
|
||||
DIR_HTML = '/tmpl/',
|
||||
DIR_HTML_FS = DIR_HTML + 'fs/',
|
||||
DIR_JSON = '/json/';
|
||||
DIR_JSON = '/json/',
|
||||
timeout = getTimeoutOnce(2000);
|
||||
|
||||
this.get = function(name, callback) {
|
||||
var type = Util.type(name);
|
||||
|
|
@ -125,7 +126,27 @@
|
|||
Storage.setAllowed(data.localStorage);
|
||||
|
||||
callback(null, data);
|
||||
|
||||
timeout(function() {
|
||||
Promises.config = null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getTimeoutOnce(time) {
|
||||
var is,
|
||||
fn = function(callback) {
|
||||
if (!is) {
|
||||
is = true;
|
||||
|
||||
setTimeout(function() {
|
||||
is = false;
|
||||
callback();
|
||||
}, time);
|
||||
}
|
||||
};
|
||||
|
||||
return fn;
|
||||
}
|
||||
}
|
||||
})(Util, DOM);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue