Fix guard against concurrently loading of assets.

This commit is contained in:
Guo Xiang Tan 2017-07-17 13:04:30 +09:00
parent c5401a0927
commit d613f3f559
1 changed files with 3 additions and 2 deletions

View File

@ -36,7 +36,8 @@ export default function loadScript(url, opts) {
opts = opts || {};
$('script').each((i, tag) => {
_loaded[tag.getAttribute('src')] = true;
const src = tag.getAttribute('src');
if (src) _loaded[tag.getAttribute('src')] = true;
});
@ -57,12 +58,12 @@ export default function loadScript(url, opts) {
});
const cb = function(data) {
_loaded[url] = true;
if (opts && opts.css) {
$("head").append("<style>" + data + "</style>");
}
done();
resolve();
_loaded[url] = true;
};
let cdnUrl = url;