how to integrate rscript with javascript

How can i integrate rscript with javascript to make a desktop application , for statistical calculation and plotting of datasets.

This is possible in theory, but I haven't seen any working examples. The {shiny} package provides the functionality but it requires a local or remote server to execute R scripts. Integrating an R interpreter, JS based UI, a graphics device facility into a WASM application using a language such as Rust, Go or Julia would be a heavy lift.

UPDATE: I was wrong. This is what webR does.