Skip to content

Commit

Permalink
Merge branch 'envjsrb' of github.com:smparkes/env-js into envjsrb
Browse files Browse the repository at this point in the history
  • Loading branch information
smparkes committed Feb 5, 2010
2 parents ff5b6e4 + 0b6d502 commit 8c858bc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,27 @@ For now, you can install the envjs gem by installing Johnson:

gem install envjs

The envjs gem provides the envjsrb command, which functions as an extended version of the Johnson javascript shell. For example:

mbp:env-js smparkes$ envjsrb
js> this
=> [object Window 0]
js> window.location
=> about:blank
js> document.innerHTML
=> "<html><head><title></title></head><body></body></html>"
js>

It's also possible to embed the envjs interpreter similar to the way it's done in Johnson, e.g.,

require 'rubygems' # if necessary
require 'johnson/tramonkey'
require 'envjs/runtime'

envjs = Johnson::Runtime.new
envjs.extend Envjs::Runtime
window = envjs.evaluate("")
puts window.location.to_s # == "about:blank"
puts window.document.innerHTML # == "<html><head><title></title></head><body></body></html>"

Comments to http://groups.google.com/group/envjs or #envjs on freenode.

0 comments on commit 8c858bc

Please sign in to comment.