fewd/priv/static/js/dist/tetris.js

30 lines
685 B
JavaScript

/**
* Tetris
*
* @module
*/
main();
async function main() {
let ws = new WebSocket("/ws/tetris");
let elt_tetris_state = document.getElementById('tetris-state');
ws.onmessage =
(e) => {
handle_evt(e, elt_tetris_state);
};
}
//-----------------------------------------------------
// Tetris
//-----------------------------------------------------
/**
* take the entire tetris state, render the html elements
*
* then fish out the element in the document, and replace it
*
* blitting basically
*/
async function handle_evt(e, oelt) {
let state_str = e.data;
oelt.value = state_str;
}
export {};
//# sourceMappingURL=tetris.js.map