diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..b5298d486 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +[build] +# See https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html +# Required for https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.FileSystemSyncAccessHandle.html +rustflags = ["--cfg=web_sys_unstable_apis"] diff --git a/nemo-wasm/src/lib.rs b/nemo-wasm/src/lib.rs index 1865dbaf7..82421ac69 100644 --- a/nemo-wasm/src/lib.rs +++ b/nemo-wasm/src/lib.rs @@ -380,3 +380,8 @@ fn custom_alloc_error_hook(layout: Layout) { pub fn set_alloc_error_hook() { std::alloc::set_alloc_error_hook(custom_alloc_error_hook); } + +#[wasm_bindgen(js_name = "getNemoVersion")] +pub fn nemo_version() -> Option { + option_env!("CARGO_PKG_VERSION").map(|version| version.into()) +}