-
Notifications
You must be signed in to change notification settings - Fork 51
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
Writing to console.log specifically #406
Comments
Hmm it seems "pp" can be used to do so. Still I think it may be useful to add it to a FAQ entry. On a semi-related note, when I use "pp", the console also says:
And so forth. Not sure why. I am using: https://cdn.jsdelivr.net/npm/@ruby/[email protected]/dist/browser.script.iife.js |
JS.global[:console].log('hello') Feel free to make whatever shortcut you find comfortable: # global variable
$console = JS.global[:console]
$console.log('hello')
# Kernel patch
# (this is where `puts` is defined too)
module Kernel
def console
JS.global[:console]
end
end
console.log('hello')
console.error('bad') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the FAQ currently we have code like this:
Then we can simply use puts, which is convenient.
But how to write to console.log?
Past this point if we use:
It will no longer write to console.log, instead just to primary stdout in the browser.
Is there a way to still write to console.log somehow? Could this be added to FAQ?
If not, could there be a way to show this? I'd like to get debug-like output right
via console.log() as well, so being able to write onto console.log even when having
modified $stdout, would be convenient, in my opinion. Could such a way be added
in addition to ruby.wasm?
The text was updated successfully, but these errors were encountered: