execjs-async 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +40 -0
- data/execjs-async.gemspec +1 -1
- data/lib/execjs-async/version.rb +1 -1
- metadata +5 -4
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
ExecJS Async
|
2
|
+
======
|
3
|
+
|
4
|
+
ExecJS lets you run JavaScript code from Ruby. ExecJS Async allows you to execute, and receive results from, asynchronous javascript.
|
5
|
+
|
6
|
+
ExecJS Async supports these runtimes (will try to support more in the future, but this is an early release):
|
7
|
+
|
8
|
+
* [Node.js](http://nodejs.org/)
|
9
|
+
|
10
|
+
A short example:
|
11
|
+
|
12
|
+
require "execjs-async"
|
13
|
+
context = ExecJS.compile_async <<-JAVASCRIPT
|
14
|
+
var run = function(html, code){
|
15
|
+
var jsdom = require('jsdom');
|
16
|
+
|
17
|
+
jsdom.env(html, function(errors, window) {
|
18
|
+
callback(window.document.getElementByName('body').innerHTML);
|
19
|
+
});
|
20
|
+
}
|
21
|
+
JAVASCRIPT
|
22
|
+
context.call 'run', "<p>Hello World</p>"
|
23
|
+
# => "<p>Hello World</p>"
|
24
|
+
|
25
|
+
|
26
|
+
Notice the "callback" call in the compiled javascript code above. The object passed into this callback will be the result of context#call. Without ExecJS Async you would not be able to get back 'window.document.getElementByName('body').innerHTML' because jsdom.env is asynchronous. And since more and more js libs are being written asynchronously these days (thanks to the popularity of node.js), it would make sense to support it in ExecJS (even if it's hard to support it across runtimes)
|
27
|
+
|
28
|
+
Even though ExecJS supports just calling ExecJS.eval or ExecJS.exec, async only supports using ExecJS.compile_async, because that is how it is currently being used.
|
29
|
+
|
30
|
+
# Installation
|
31
|
+
|
32
|
+
$ gem install execjs-async
|
33
|
+
|
34
|
+
# License
|
35
|
+
|
36
|
+
Copyright (c) 2011 Eric Allam.
|
37
|
+
|
38
|
+
ExecJS is maintained by Sam Stephenson and Josh Peek.
|
39
|
+
|
40
|
+
Released under the MIT license.
|
data/execjs-async.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Execjs::Async::VERSION
|
8
8
|
s.authors = ["Eric Allam"]
|
9
9
|
s.email = ["rubymaverick@gmail.com"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "https://github.com/rubymaverick/execjs-async"
|
11
11
|
s.summary = %q{Enables Asynchronous Javascript Execution in ExecJS}
|
12
12
|
s.description = %q{Enables Asynchronous Javascript Execution in ExecJS}
|
13
13
|
|
data/lib/execjs-async/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: execjs-async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-08-28 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: execjs
|
16
|
-
requirement: &
|
16
|
+
requirement: &70199540499960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70199540499960
|
25
25
|
description: Enables Asynchronous Javascript Execution in ExecJS
|
26
26
|
email:
|
27
27
|
- rubymaverick@gmail.com
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- .rvmrc
|
34
34
|
- Gemfile
|
35
35
|
- Gemfile.lock
|
36
|
+
- README.md
|
36
37
|
- Rakefile
|
37
38
|
- execjs-async.gemspec
|
38
39
|
- lib/execjs-async.rb
|
@@ -40,7 +41,7 @@ files:
|
|
40
41
|
- test/support.rb
|
41
42
|
- test/test_execjs.rb
|
42
43
|
- test/test_runtime.rb
|
43
|
-
homepage:
|
44
|
+
homepage: https://github.com/rubymaverick/execjs-async
|
44
45
|
licenses: []
|
45
46
|
post_install_message:
|
46
47
|
rdoc_options: []
|