mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
[GenericL10n] Fetch the language bundles in parallel to reduce load time
For non `en-US` locales this will, ever so slightly, shorten the time it takes to load and parse the language bundles.
This commit is contained in:
parent
d6f63d0e4b
commit
8d8e25c89d
1 changed files with 8 additions and 2 deletions
|
@ -89,8 +89,14 @@ class GenericL10n extends L10n {
|
|||
}
|
||||
langs.push(defaultLang);
|
||||
}
|
||||
for (const lang of langs) {
|
||||
const bundle = await this.#createBundle(lang, baseURL, paths);
|
||||
// Trigger fetching of bundles in parallel, to reduce overall load time.
|
||||
const bundles = langs.map(lang => [
|
||||
lang,
|
||||
this.#createBundle(lang, baseURL, paths),
|
||||
]);
|
||||
|
||||
for (const [lang, bundlePromise] of bundles) {
|
||||
const bundle = await bundlePromise;
|
||||
if (bundle) {
|
||||
yield bundle;
|
||||
} else if (lang === "en-us") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue