wasm object interaction test

This commit is contained in:
2026-08-20 00:20:02 +02:00
parent 63c19c3baa
commit c6e8849b28
6 changed files with 41 additions and 3 deletions
+18
View File
@@ -1,10 +1,28 @@
use wasm_bindgen::prelude::*;
use crate::{solver, word_list::WordList};
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
}
#[wasm_bindgen]
pub fn greet() {
alert("Hello, wasm-on-web!");
}
#[wasm_bindgen]
struct Solver(solver::Solver);
#[wasm_bindgen]
impl Solver {
pub fn new() -> Solver {
let wl = WordList::from(["test", "yooo"].iter());
Solver(solver::Solver::from_single_word_list(wl))
}
pub fn stats(&self) -> String {
self.0.tabular_format()
}
}