Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Unable to reuse a JavaScriptFunction to call from ruby back to javascript

Đang mở
#228 3 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, ruby
Lĩnh vực
backend

Hướng nghiên cứu

Start by tracing how MiniRacer::JavaScriptFunction values are exposed to Ruby and how the existing callback mechanism crosses between Ruby and JavaScript. The issue gives no file or test names, so locate those entry points and related tests before estimating the change. Done means a Ruby callback can invoke the JavaScript function and continue the described round trip; add or identify coverage for that behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I have attached a ruby block to my js context in order to power a callback mechanism. It should go ruby -> js -> ruby -> js (and maybe a few more times after that). My code looks something like:

      subject.register_helper('alsowith') do |this, context, block|
        context["fn"]
      end

where context looks like this in a debugger:

0> context
=> {"name"=>"alsowith", "hash"=>{}, "fn"=>#<MiniRacer::JavaScriptFunction:0x00007fd20c0a3620>, "inverse"=>#<MiniRacer::JavaScriptFunction:0x00007fd20c0a34e0>, "data"=>{"root"=>{"weather"=>{"summary"=>"sunny"}}}}

Unfortunately I can't use the "fn" key's value, a JavaScriptFunction appears to be an empty class and not invocable. I was expecting something like context["fn"].call(123) so I could keep going.

Ngôn ngữ chính
JavaScript
Star
628
Fork
100
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rubyjs/mini_racer

Tất cả issue của rubyjs/mini_racer

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.