diff --git a/nexrad-browser/www/bootstrap.js b/nexrad-browser/www/bootstrap.js new file mode 100644 index 0000000..7a8aa78 --- /dev/null +++ b/nexrad-browser/www/bootstrap.js @@ -0,0 +1,2 @@ +import("./index.js") + .catch(e => console.error("Error importing `index.js`:", e)); \ No newline at end of file diff --git a/nexrad-browser/www/index.html b/nexrad-browser/www/index.html new file mode 100644 index 0000000..89c6523 --- /dev/null +++ b/nexrad-browser/www/index.html @@ -0,0 +1,37 @@ + + + NEXRAD Browser + + + +
+
+ +
+
+ + + +
+
+
+ + + + + + \ No newline at end of file diff --git a/nexrad-browser/www/index.js b/nexrad-browser/www/index.js new file mode 100644 index 0000000..0b0afa7 --- /dev/null +++ b/nexrad-browser/www/index.js @@ -0,0 +1,17 @@ +import * as wasm from "./wasm/nexrad_browser.js"; +await wasm.default(); +wasm.__nxrd_browser_init(); + +console.log("[JS] setup event listeners"); + +const fileSelector = document.getElementById('file'); + +document.getElementById("go").addEventListener("click", (e) => { + const file = fileSelector.files[0]; + const reader = new FileReader(); + reader.addEventListener('load', (event) => { + let data = event.target.result; + wasm.load_ar2(data); + }); + reader.readAsArrayBuffer(file); +}); \ No newline at end of file