feature(files) add getTimeoutOnce

This commit is contained in:
coderaiser 2015-06-30 15:16:48 -04:00
parent 05f25e994e
commit c39e343357

View file

@ -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);