Sha256: d868802e97e3c0872577959030292de5be845f7a9eaa9a97f1cb8dbabc55a843
Contents?: true
Size: 1.68 KB
Versions: 7
Compression:
Stored size: 1.68 KB
Contents
= env.js * http://github.com/smparkes/env-js * http://groups.google.com/group/envjs * #envjs @ freenode == Description A browser environment for javascript interpreters. This is a fork of the env.js project (http://github.com/thatcher/env-js/). See that link for env.js details. This fork is based on the Johnson Ruby gem (http://github.com/jbarnette/johnson). == Installation For now, you can install the envjs gem by installing Johnson: gem install johnson --prerelease and then installing the envjs gem with gem install envjs == Using envjs interactively 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> == Embedding envjs 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/tracemonkey' require 'envjs/runtime' envjs = Johnson::Runtime.new envjs.extend Envjs::Runtime window = envjs.evaluate("window") puts window.location.to_s # == "about:blank" puts window.document.innerHTML # == "<html><head><title></title></head><body></body></html>" envjs.wait You need the Runtime#wait at the end to give env.js's event loop a chance to execute queued events and timers. You may need to do this at other times as well, depending on the asynchronous nature of your application. == License See http://github.com/smparkes/env-js/blob/envjsrb/licenses/MIT-LICENSE.txt and http://github.com/smparkes/env-js/blob/envjsrb/licenses/GPL-LICENSE.txt.
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
envjs-0.3.5 | README.rdoc |
envjs-0.3.4 | README.rdoc |
envjs-0.3.3 | README.rdoc |
envjs-0.3.2 | README.rdoc |
envjs-0.3.1 | README.rdoc |
envjs-0.3.0 | README.rdoc |
envjs-0.2.0 | README.rdoc |