rtwx/nexrad-browser/www/index.js

17 lines
507 B
JavaScript

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