refactor: use Promise.all instead of multiple awaits
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
62c97a0659
commit
ad1c1987fc
|
@ -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*
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue