import * as wasm from "./wasm/nexrad_browser.js"; await wasm.default(); let global_context = wasm.__nxrd_browser_init(); function rescaleCanvas(canvas, ctx) { var dpr = window.devicePixelRatio || 1; // Get the size of the canvas in CSS pixels. var rect = canvas.getBoundingClientRect(); // Give the canvas pixel dimensions of their CSS // size * the device pixel ratio. canvas.width = rect.width * dpr; canvas.height = rect.height * dpr; // Scale all drawing operations by the dpr, so you // don't have to worry about the difference. ctx.scale(dpr, dpr); } window.rescaleCanvas = rescaleCanvas; window.loadar2 = (s) => { const file = document.getElementById("file").files[0]; document.getElementById("file").value = null; const reader = new FileReader(); reader.addEventListener('load', (event) => { let data = event.target.result; wasm.load_ar2(data, global_context); }); reader.readAsArrayBuffer(file); console.log(s); } // END GLOBAL FUNCTION DEFS window.onkeydown = (e) => { wasm.keydown(global_context, e.key); } document.getElementById("file").onchange = () => { wasm.new_file_available(global_context); } let render = () => { wasm.render_abi(global_context); requestAnimationFrame(render); } requestAnimationFrame(render);