add www files

This commit is contained in:
core 2023-11-03 16:33:22 -04:00
parent 72908de36f
commit ced2b9be8b
Signed by: core
GPG Key ID: FDBF740DADDCEECF
3 changed files with 56 additions and 0 deletions

2
nexrad-browser/www/bootstrap.js vendored Normal file
View File

@ -0,0 +1,2 @@
import("./index.js")
.catch(e => console.error("Error importing `index.js`:", e));

View File

@ -0,0 +1,37 @@
<html>
<head>
<title>NEXRAD Browser</title>
<style>
.grid-parent {
display: grid;
grid-template-columns: 2fr .5fr;
grid-template-rows: 1fr;
grid-column-gap: 5px;
grid-row-gap: 0px;
height: 100%;
}
.canvas-container {
border-right: 2px solid black;
height: 100%;
}
</style>
</head>
<body>
<div class="grid-parent">
<div class="canvas-container">
<canvas id="canvas"></canvas>
</div>
<div>
<label for="file">Upload Archive II file</label>
<input type="file" id="file" />
<button id="go">Load</button>
<hr>
</div>
</div>
<script src="bootstrap.js"></script>
</body>
</html>

View File

@ -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);
});