Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#228 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, ruby
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
628
Fork
100
Merge medio
1g 20h
PR unite (30g)
2

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rubyjs/mini_racer

Tutte le issue di rubyjs/mini_racer

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.