From ced2b9be8b3228e8d1ac4a0b6679d6bcdd596a81 Mon Sep 17 00:00:00 2001 From: core Date: Fri, 3 Nov 2023 16:33:22 -0400 Subject: [PATCH] add www files --- nexrad-browser/www/bootstrap.js | 2 ++ nexrad-browser/www/index.html | 37 +++++++++++++++++++++++++++++++++ nexrad-browser/www/index.js | 17 +++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 nexrad-browser/www/bootstrap.js create mode 100644 nexrad-browser/www/index.html create mode 100644 nexrad-browser/www/index.js 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