opal-browser icon indicating copy to clipboard operation
opal-browser copied to clipboard

Using opal-browser in repl

Open jikkujose opened this issue 9 years ago • 3 comments

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.

jikkujose avatar Feb 16 '15 15:02 jikkujose

Unfortunately, that's not possible. Opal-Browser requires a browser.

hmdne avatar Jul 23 '21 06:07 hmdne

I will soon add a "miniirb" example which would provide as both an example to opal-browser and as a debugging tool.

hmdne avatar Jul 25 '21 14:07 hmdne

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)

hmdne avatar Oct 10 '21 15:10 hmdne