Skip to content

Instantly share code, notes, and snippets.

@thisisjofrank
Last active April 16, 2020 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thisisjofrank/e026bf204d497852cdd3857bc1d7fd94 to your computer and use it in GitHub Desktop.
Save thisisjofrank/e026bf204d497852cdd3857bc1d7fd94 to your computer and use it in GitHub Desktop.
startGame function
async function startGame() {
dataSource = new AblyTrainArrivalsClient()
game = new Game();
ui = new GameUi(game);
game.start({
onGameStart: async () => await dataSource.listenForEvents("940GZZLUKSX", msg => game.registerEvent(game, msg)),
onGameEnd: () => dataSource.stopListening()
});
ui.startRendering(game);
return game;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment