forked from mystiq/hydrogen-web
Parellelize code
This commit is contained in:
parent
b5fd3656a7
commit
53a8915ffc
1 changed files with 4 additions and 10 deletions
|
@ -58,16 +58,10 @@ export class ThemeLoader {
|
||||||
async init(manifestLocations: string[], log?: ILogItem): Promise<void> {
|
async init(manifestLocations: string[], log?: ILogItem): Promise<void> {
|
||||||
await this._platform.logger.wrapOrRun(log, "ThemeLoader.init", async (log) => {
|
await this._platform.logger.wrapOrRun(log, "ThemeLoader.init", async (log) => {
|
||||||
this._themeMapping = {};
|
this._themeMapping = {};
|
||||||
for (const manifestLocation of manifestLocations) {
|
const results = await Promise.all(
|
||||||
const { body } = await this._platform
|
manifestLocations.map( location => this._platform.request(location, { method: "GET", format: "json", cache: true, }).response())
|
||||||
.request(manifestLocation, {
|
);
|
||||||
method: "GET",
|
results.forEach(({ body }) => this._populateThemeMap(body, log));
|
||||||
format: "json",
|
|
||||||
cache: true,
|
|
||||||
})
|
|
||||||
.response();
|
|
||||||
this._populateThemeMap(body, log);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue