Skip to content

Commit

Permalink
main: switch to async
Browse files Browse the repository at this point in the history
  • Loading branch information
jhillyerd committed May 10, 2020
1 parent 187de5a commit 5a510ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const urls = {
};

// Entrypoint, called when page has finished loading.
function main(): void {
async function main(): Promise<void> {
const servicesId = "serviceListContainer";
const servicesEl = document.getElementById(servicesId);
if (servicesEl == null) {
Expand All @@ -23,9 +23,9 @@ function main(): void {
}

// Load dynamic configuration data and setup the page.
fetch(urls.data).
then((res: Response) => res.json()).
then((config: ConfigData) => renderServices(servicesEl, config.services));
const res = await fetch(urls.data);
const config: ConfigData = await res.json();
renderServices(servicesEl, config.services);
}

// Returns a URL pointing to `path` on the originating server.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"devDependencies": {
"parcel-bundler": "^1.12.4"
},
"browserslist": [ "> 2%" ],
"dependencies": {
"@fortawesome/fontawesome-free": "^5.13.0",
"lit-html": "^1.2.1",
Expand Down

0 comments on commit 5a510ec

Please sign in to comment.