mirror of
https://github.com/discourse/discourse.git
synced 2025-01-21 08:53:59 +08:00
ffc241eb25
This is how `loadScript(url)` currently deals with multiple concurrent requests 1. Check existing `<script>` tags, and mark existing scripts (other than the input `url`) as loaded 2. Find "true" `url` of the requested resource (CDN, subfolder path, etc) 3. Check if we have loaded the resource with that "true" `url`, and resolve immediately if we have 4. Otherwise insert a `<script>` tag with the "true" `url` to load it For example, in a subfolder install: - Input `url` = `/javascripts/script.js` - "True" `url` = `/subfolder/javascript/script.js` And the _very_ subtle bug here is that we should use also use the true `url` for step (1), because: - Since the input and true `url` are different, we mistakenly mark the true `url` as loaded in step one - After finding the true `url`, and setting `loaded[trueUrl] = true` in (1), we resolve the promise prematurely, when the resource could still be loading |
||
---|---|---|
.. | ||
admin | ||
discourse | ||
discourse-common | ||
docs | ||
ember-addons | ||
locales | ||
pretty-text | ||
select-kit | ||
wizard | ||
admin.js.erb | ||
application.js | ||
authentication-complete.js.no-module.es6 | ||
deprecated.js | ||
discourse-loader.js | ||
discourse-objects.js | ||
discourse.js.es6 | ||
ember_include.js.erb | ||
ember_jquery.js | ||
ember-shim.js | ||
env.js | ||
google-tag-manager.js.no-module.es6 | ||
google-universal-analytics.js.no-module.es6 | ||
main_include_admin.js | ||
markdown-it-bundle.js | ||
plugin-third-party.js.erb | ||
plugin.js.erb | ||
polyfills.js | ||
preload-application-data.js.no-module.es6 | ||
preload-store.js.es6 | ||
pretty-text-bundle.js | ||
service-worker.js.erb | ||
template_include.js.erb | ||
vendor.js | ||
wizard-application.js | ||
wizard-vendor.js |