Skip to content

Commit

Permalink
Use Promise.all
Browse files Browse the repository at this point in the history
  • Loading branch information
HashidaTKS committed Oct 2, 2024
1 parent 23f8551 commit a87537c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ function getToAsync() {
}

async function getAllData() {
const to = await getToAsync();
const cc = await getCcAsync();
const bcc = await getBccAsync();
const trustedString = await loadFile("configs/trusted.txt");
const untrustedString = await loadFile("configs/untrusted.txt");
const attachmentsString = await loadFile("configs/attachment.txt");
const [to, cc, bcc, trustedString, untrustedString, attachmentsString] = await Promise.all([
getToAsync(),
getCcAsync(),
getBccAsync(),
loadFile("configs/trusted.txt"),
loadFile("configs/untrusted.txt"),
loadFile("configs/attachment.txt"),
]);
const trusted = toArray(trustedString);
const untrusted = toArray(untrustedString);
const attachments = toArray(attachmentsString);
Expand Down

0 comments on commit a87537c

Please sign in to comment.