opal-browser
opal-browser copied to clipboard
Using opal-browser in repl
Is it possible to inspect opal-browser
through the repl? I was able to require opal
and inspect it, but similarly requiring opal-browser
didn't seem to work.
Unfortunately, that's not possible. Opal-Browser requires a browser.
I will soon add a "miniirb" example which would provide as both an example to opal-browser and as a debugging tool.
Opal 1.3.0 has a revamped repl. You should be able to do this:
$ mkdir opal-browser-repl
$ cd opal-browser-repl
$ cat > Gemfile
source 'https://rubygems.org'
gem 'opal', '>= 1.3.0a'
gem 'opal-browser', github: 'opal/opal-browser'
$ bundle install
$ bundle exec opal-repl -Rchrome -qopal-browser -rpromise/v2 -rbrowser
>> $document.body
=> #<DOM::Element: body>
(Now, a good question would be, how to run this Chrome not-headless, and for that we don't have an answer yet, but I think I can add some PR before 1.3.0 stable gets released)