We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I cannot make app work with locally build ruby.wasm. I built the wasm binary by issuing: bundle exec rbwasm build -o ruby.wasm
bundle exec rbwasm build -o ruby.wasm
This is my project.
Gemfile:
# frozen_string_literal: true source "https://rubygems.org" # Gemfile gem 'ruby_wasm' gem 'victor', '~> 0.5.0'
Gemfile.lock:
GEM remote: https://rubygems.org/ specs: ruby_wasm (2.7.1) ruby_wasm (2.7.1-aarch64-linux) ruby_wasm (2.7.1-aarch64-linux-musl) ruby_wasm (2.7.1-arm64-darwin) ruby_wasm (2.7.1-x86_64-darwin) ruby_wasm (2.7.1-x86_64-linux) ruby_wasm (2.7.1-x86_64-linux-musl) victor (0.5.0) PLATFORMS aarch64-linux aarch64-linux-musl arm64-darwin ruby x86_64-darwin x86_64-linux x86_64-linux-musl DEPENDENCIES ruby_wasm victor (~> 0.5.0) BUNDLED WITH 2.6.2
index.html:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Ruby WASM</title> </head> <body></body> <script type="module" src="index.js"></script> </html>
index.js:
import { DefaultRubyVM } from "https://cdn.jsdelivr.net/npm/@ruby/wasm-wasi@2.7.1/dist/browser/+esm"; const response = await fetch("./ruby.wasm"); const module = await WebAssembly.compileStreaming(response); const { vm } = await DefaultRubyVM(module); vm.eval(` require "js" JS.global[:document].write "TEST" `);
What I get in the JS console is: Uncaught TypeError: FinalizationRegistry: cleanup must be callable.
Uncaught TypeError: FinalizationRegistry: cleanup must be callable
When I try it with the cdn binary as documented in the cheat sheet every thing works without any issues.
What I want to achieve in the end is to execute a simple script:
# app.rb require 'victor' svg = Victor::SVG.new width: 100, height: 100 svg.build do rect x: 10, y: 10, width: 80, height: 80, fill: 'blue' circle cx: 50, cy: 50, r: 30, fill: 'green' end puts svg.render
The text was updated successfully, but these errors were encountered:
Thank you for reporting. Could you try adding gem "js" to your Gemfile and rebuild the wasm again?
gem "js"
Sorry, something went wrong.
Thanks a lot this fixed it :) I'm closing the issue :)
No branches or pull requests
Issue
I cannot make app work with locally build ruby.wasm. I built the wasm binary by issuing:
bundle exec rbwasm build -o ruby.wasm
This is my project.
Gemfile:
Gemfile.lock:
index.html:
index.js:
Result
What I get in the JS console is:
Uncaught TypeError: FinalizationRegistry: cleanup must be callable
.When I try it with the cdn binary as documented in the cheat sheet every thing works without any issues.
What I want
What I want to achieve in the end is to execute a simple script:
The text was updated successfully, but these errors were encountered: