this_algorithm/this_algorithm-wasm/index.js
2023-02-25 14:12:18 -05:00

24 lines
616 B
JavaScript

// import init, { log_to_address, greet } from "./pkg/this_algorithm_wasm.js";
// init().then(() => {
// console.log(greet());
// });
import init, { address_lat_lon } from "./pkg/this_algorithm_wasm.js";
init().then(() => {
let update = () => {
let lat = parseFloat(addressLat.value);
let lon = parseFloat(addressLon.value);
if (!(lat || lat == 0.0) && !(lon || lon == 0.0)) {
return;
}
let ret = address_lat_lon(lat, lon);
addressResult.textContent = ret;
};
addressLat.addEventListener("input", update);
addressLon.addEventListener("input", update);
update();
});