[refactor] Moved 'getElementById' to its own TS file.

This commit is contained in:
Steven Evans
2018-07-05 13:23:12 -04:00
parent 8c25684fe1
commit 488f947a5b
4 changed files with 20 additions and 26 deletions
+3 -7
View File
@@ -1,4 +1,5 @@
import { createElement } from "./createElement";
import { getElementById } from "./getElementById";
/**
* Creates the necessary DOM elements to present an in-game popup to the player.
@@ -20,13 +21,8 @@ export function createPopup(id: string, elems: HTMLElement[]) {
content.appendChild(elem);
}
container.appendChild(content);
const gameContainer: HTMLElement | null = document.getElementById("entire-game-container");
if (gameContainer === null) {
throw new Error("Unable to find the game container. Something is *seriously* wrong...");
}
gameContainer.appendChild(container);
getElementById("entire-game-container")
.appendChild(container);
return container;
}