Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JosiahParry/webr-js-rs
Rust bindings to the WebR javascript library
https://github.com/JosiahParry/webr-js-rs
Last synced: about 1 month ago
JSON representation
Rust bindings to the WebR javascript library
- Host: GitHub
- URL: https://github.com/JosiahParry/webr-js-rs
- Owner: JosiahParry
- Created: 2024-05-27T16:55:36.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-06-28T15:52:48.000Z (3 months ago)
- Last Synced: 2024-06-28T17:20:12.598Z (3 months ago)
- Language: Rust
- Size: 70.3 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - JosiahParry/webr-js-rs - Rust bindings to the WebR javascript library (Rust)
README
# webr-js-sys
Unofficial wasm-bindgen bindings for the [`WebR` JavaScript library](https://docs.r-wasm.org/) written in Rust.
This library crate only work ons wasm32-unknown-unknown target.
```rs
// create a new instance
let webr = crate::webr::WebR::new();// initialize webR
let _ = webr.init().await;// write to the console
let _ = webr.write_console("rnorm(100)".into());// flush the console and read the output
let res = webr.flush_and_read().await;
res.iter().for_each(|x| {
web_sys::console::log_1(&JsValue::from_str(x));
});
```