https://github.com/JosiahParry/webr-js-rs
Rust bindings to the WebR javascript library
https://github.com/JosiahParry/webr-js-rs
Last synced: 7 months 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-03T13:51:57.000Z (12 months ago)
- Last Synced: 2024-12-02T04:37:23.349Z (7 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));
});
```