Skip to content
New issue

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

Documentation on input, output and error handlers too sparse #13

Open
Kappie opened this issue Mar 15, 2014 · 1 comment
Open

Documentation on input, output and error handlers too sparse #13

Kappie opened this issue Mar 15, 2014 · 1 comment

Comments

@Kappie
Copy link

Kappie commented Mar 15, 2014

I'm trying to make a ruby REPL on my site, but the documentation on the input, output and error args in the Ruby.initialize function needs more examples.

How, for example, do I set up the input callback with jq-console?

input = ->
  jqconsole.Input( (input) ->
    jqconsole.Write(input) )
  console.log("input callback fired")
  return null

"input callback fired" is logged before I can type input in the console. How do I pass user input from the console to the input callback when jqconsole.Input seems to wait for other functions to finish?

@max99x
Copy link
Contributor

max99x commented Mar 16, 2014

Emscripten stream input is synchronous, while JQConsole's input is asynchronous. There's no simple way to connect them. JSRepl uses a hack: either a server or a client-side database as a sync point:
https://github.com/replit/jsrepl/blob/4f356b71e93398d5b993ae21a064a30947208972/sandbox.js#L280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants