I'm looking for the correct way of calling Ruby from JavaScript in the browser when building a WASM application. Naively calling a defined method doesn't work because the method isn't in scope.
Asked
Active
Viewed 60 times
1 Answers
0
The answer I've found thus far is to use the below:
rubyVM.eval("example")
Or similar with parameters:
rubyVM.eval("example 3 'some_string'")
It's the only solution I've found thus far, so I'd be interested in a better way, but it does work.
Note that because of how long the RubyVM takes to load, you will need to do something like this with your script for the RubyVM to be available:

zachaysan
- 1,726
- 16
- 32