1
0
Fork 0
tsgames/src/index.ts

16 lines
425 B
TypeScript

declare const GAME: string;
async function main() {
const { default: runGame }: { default: RunGame } = await import(`./games/${GAME}`);
const canvas = document.getElementById('canvas');
if (canvas instanceof HTMLCanvasElement) {
await runGame(canvas);
} else {
alert('Something wrong with your canvas!');
}
}
main().catch((e) => {
console.error(e);
// TODO display error page
});