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 = {
|
const preambles = {
|
||||||
'extended-player-profile': `// ==UserScript==
|
'extended-player-profile': `// ==UserScript==
|
||||||
// @name Extended player profile
|
// @name Extended player profile
|
||||||
// @version 1.1.1
|
// @version 1.1.2
|
||||||
// @description Adds additional info and actions on a player overview.
|
// @description Adds additional info and actions on a player overview.
|
||||||
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
||||||
// @match https://*/game.php?*screen=info_player*
|
// @match https://*/game.php?*screen=info_player*
|
||||||
|
@ -13,7 +13,7 @@ const preambles = {
|
||||||
// ==/UserScript==`,
|
// ==/UserScript==`,
|
||||||
'extended-map-popup': `// ==UserScript==
|
'extended-map-popup': `// ==UserScript==
|
||||||
// @name Extended map popup
|
// @name Extended map popup
|
||||||
// @version 1.0.1
|
// @version 1.0.2
|
||||||
// @description Extends the map popup with additional info.
|
// @description Extends the map popup with additional info.
|
||||||
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
||||||
// @match https://*/game.php?*screen=map*
|
// @match https://*/game.php?*screen=map*
|
||||||
|
@ -25,7 +25,7 @@ const preambles = {
|
||||||
// ==/UserScript==`,
|
// ==/UserScript==`,
|
||||||
'extended-village-profile': `// ==UserScript==
|
'extended-village-profile': `// ==UserScript==
|
||||||
// @name Extended village profile
|
// @name Extended village profile
|
||||||
// @version 1.0.0
|
// @version 1.0.1
|
||||||
// @description Adds additional info and actions on a village overview.
|
// @description Adds additional info and actions on a village overview.
|
||||||
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
// @author Dawid Wysokiński - Kichiyaki - contact@dwysokinski.me
|
||||||
// @match https://*/game.php?*screen=info_village*
|
// @match https://*/game.php?*screen=info_village*
|
||||||
|
|
|
@ -254,8 +254,10 @@ class ExtendedMapPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
const config = await this.connector.serverConfig();
|
const [config, unitInfo] = await Promise.all([
|
||||||
const unitInfo = await this.connector.unitInfo();
|
this.connector.serverConfig(),
|
||||||
|
this.connector.unitInfo(),
|
||||||
|
]);
|
||||||
|
|
||||||
new Popup(
|
new Popup(
|
||||||
config,
|
config,
|
||||||
|
|
|
@ -589,8 +589,10 @@ class ExtendedPlayerProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
const player = await this.twhelpConnector.player();
|
const [player, latestSnapshot] = await Promise.all([
|
||||||
const latestSnapshot = await this.twhelpConnector.latestSnapshot();
|
this.twhelpConnector.player(),
|
||||||
|
this.twhelpConnector.latestSnapshot(),
|
||||||
|
]);
|
||||||
|
|
||||||
new UI(
|
new UI(
|
||||||
player,
|
player,
|
||||||
|
|
|
@ -201,8 +201,10 @@ class ExtendedVillageProfile {
|
||||||
}
|
}
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
const config = await this.connector.serverConfig();
|
const [config, ennoblement] = await Promise.all([
|
||||||
const ennoblement = await this.connector.latestEnnoblement();
|
this.connector.serverConfig(),
|
||||||
|
this.connector.latestEnnoblement(),
|
||||||
|
]);
|
||||||
|
|
||||||
new UI(config, ennoblement, this.connector).render();
|
new UI(config, ennoblement, this.connector).render();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue