feat: first working version with parameters

This commit is contained in:
2024-04-15 18:46:34 +02:00
parent e29cb11b81
commit 0254bc1ae5
45 changed files with 389 additions and 351 deletions

View File

@@ -17,7 +17,7 @@ wasm-bindgen = "0.2.84"
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
plantarium = { version = "0.1.0", path = "../../../../packages/plantarium" }
utils = { version = "0.1.0", path = "../../../../packages/utils" }
serde = { version = "1.0", features = ["derive"] }
serde-wasm-bindgen = "0.4"
console_error_panic_hook = { version = "0.1.7", optional = true }

View File

@@ -1,4 +1,3 @@
mod utils;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
@@ -8,7 +7,6 @@ pub fn get_outputs() -> Vec<String> {
#[wasm_bindgen]
pub fn get_input_types() -> String {
utils::set_panic_hook();
r#"{
"value": { "type": "float", "value": 0.1, "internal": true }
}"#
@@ -17,7 +15,5 @@ pub fn get_input_types() -> String {
#[wasm_bindgen]
pub fn execute(args: &[i32]) -> Vec<i32> {
utils::set_panic_hook();
args.into()
}

View File

@@ -1,10 +0,0 @@
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
}