January 2024
Intermediate to advanced
718 pages
20h 15m
English
Web Assembly (Wasm) is a virtual machine runtime engine that runs in a web browser, allowing any Wasm-compliant programming language to be used as a scripting language in that browser.
Ruby 3.2 added support for Wasm as a compilation target of Ruby. You can see full instructions for creating your own Wasm build at https://github.com/ruby/ruby/blob/master/wasm/README.md, but in most cases you’ll likely either pull in the Wasm build as a module in Node Package Manager (NPM) or point to a source for the Wasm build in your web page.
So, you can do this in an HTML file:
| | <html> |
| | <script |
| | src="https://cdn.jsdelivr.net/npm/ruby-head-wasm-wasi@0.5.0/dist/browser.script.iife.js" |
| | ></script> |
| | <script ... |
Read now
Unlock full access