refactor: use Promise.all instead of multiple awaits
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Dawid Wysokiński 2023-02-19 07:45:40 +01:00
parent 62c97a0659
commit ad1c1987fc
Signed by: Kichiyaki
GPG Key ID: B5445E357FB8B892
4 changed files with 15 additions and 9 deletions

View File

@ -1,7 +1,7 @@
const preambles = {
'extended-player-profile': `// ==UserScript==
// @name Extended player profile
// @version 1.1.1
// @version 1.1.2
// @description Adds additional info and actions on a player overview.
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
// @match https://*/game.php?*screen=info_player*
@ -13,7 +13,7 @@ const preambles = {
// ==/UserScript==`,
'extended-map-popup': `// ==UserScript==
// @name Extended map popup
// @version 1.0.1
// @version 1.0.2
// @description Extends the map popup with additional info.
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
// @match https://*/game.php?*screen=map*
@ -25,7 +25,7 @@ const preambles = {
// ==/UserScript==`,
'extended-village-profile': `// ==UserScript==
// @name Extended village profile
// @version 1.0.0
// @version 1.0.1
// @description Adds additional info and actions on a village overview.
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
// @match https://*/game.php?*screen=info_village*

View File

@ -254,8 +254,10 @@ class ExtendedMapPopup {
}
async run() {
const config = await this.connector.serverConfig();
const unitInfo = await this.connector.unitInfo();
const [config, unitInfo] = await Promise.all([
this.connector.serverConfig(),
this.connector.unitInfo(),
]);
new Popup(
config,

View File

@ -589,8 +589,10 @@ class ExtendedPlayerProfile {
}
async run() {
const player = await this.twhelpConnector.player();
const latestSnapshot = await this.twhelpConnector.latestSnapshot();
const [player, latestSnapshot] = await Promise.all([
this.twhelpConnector.player(),
this.twhelpConnector.latestSnapshot(),
]);
new UI(
player,

View File

@ -201,8 +201,10 @@ class ExtendedVillageProfile {
}
async run() {
const config = await this.connector.serverConfig();
const ennoblement = await this.connector.latestEnnoblement();
const [config, ennoblement] = await Promise.all([
this.connector.serverConfig(),
this.connector.latestEnnoblement(),
]);
new UI(config, ennoblement, this.connector).render();
}