Skip to content

Commit

Permalink
removed DOMContentLoaded event handler and added defer attribute to t…
Browse files Browse the repository at this point in the history
…he script
  • Loading branch information
Riborok committed Oct 10, 2023
1 parent a5d2484 commit d23c666
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
</div>
</div>

<script src="src/js/bundle.js"></script>
<script src="src/js/bundle.js" defer></script>

</body>
</html>
2 changes: 1 addition & 1 deletion src/js/bundle.js

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions src/ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import {ITankChooseManager, TankChooseManager} from "./game/managers/additional/ITankChooseManager";
import {GameModeManager} from "./game/game mode/GameModeManager";


const onloadListener = () => {
const buttons = document.querySelectorAll("button");

const tankChooseManager: ITankChooseManager = new TankChooseManager();

tankChooseManager.start(GameModeManager.gameStart, buttons);

document.removeEventListener("DOMContentLoaded", onloadListener);
};
document.addEventListener("DOMContentLoaded", onloadListener);


const tankChooseManager: ITankChooseManager = new TankChooseManager();
tankChooseManager.start(GameModeManager.gameStart, document.querySelectorAll("button"));

0 comments on commit d23c666

Please sign in to comment.