/** * Tetris * * @module */ export { }; import * as libfewd from './libfewd.js'; main(); async function main () : Promise { let ws : WebSocket = new WebSocket("/ws/tetris") ; let elt_tetris_state : HTMLTextAreaElement = document.getElementById('tetris-state') as HTMLTextAreaElement ; ws.onmessage = (e: MessageEvent) => { 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 : MessageEvent, oelt : HTMLTextAreaElement) : Promise { let state_str : string = e.data as string; oelt.value = state_str; }