1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

Add info on calling js functions to README

This commit is contained in:
Scott Bronson 2013-12-23 11:44:55 -08:00
parent 9482e5b00b
commit 57beb23528

View file

@ -31,6 +31,11 @@ evaluate some simple JavaScript
cxt = V8::Context.new cxt = V8::Context.new
cxt.eval('7 * 6') #=> 42 cxt.eval('7 * 6') #=> 42
call JavaScript functions
cxt.eval "function isTruthy(arg) { return !!arg }"
cxt.scope.isTruthy(0) #=> false
embed values into the scope of your context embed values into the scope of your context
cxt['foo'] = "bar" cxt['foo'] = "bar"
@ -173,4 +178,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[1]: https://github.com/cowboyd/libv8 [1]: https://github.com/cowboyd/libv8
[2]: http://code.google.com/p/v8/wiki/BuildingWithGYP [2]: http://code.google.com/p/v8/wiki/BuildingWithGYP