mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 08:15:00 +00:00
Fix guard against concurrently loading of assets.
This commit is contained in:
parent
c5401a0927
commit
d613f3f559
@ -36,7 +36,8 @@ export default function loadScript(url, opts) {
|
|||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
$('script').each((i, tag) => {
|
$('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) {
|
const cb = function(data) {
|
||||||
_loaded[url] = true;
|
|
||||||
if (opts && opts.css) {
|
if (opts && opts.css) {
|
||||||
$("head").append("<style>" + data + "</style>");
|
$("head").append("<style>" + data + "</style>");
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
resolve();
|
resolve();
|
||||||
|
_loaded[url] = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
let cdnUrl = url;
|
let cdnUrl = url;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user