Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1d313208ab
README.md

emonk - Accidentally Refactored erlang_js

erlang_js is awesome. But I started refactoring. Now there's emonk.

With the latest versions of Emonk there's quite a bit of difference now. Emonk is NIF based and uses a thread-pool to move JavaScript execution off of the Erlang scheduler threads. Translation from Erlang terms to JavaScript objects uses a native translation step to avoid JSON overhead. I haven't gotten around to actually testing to see if there's any sort of appreciable difference in speed.

Requisites

  1. A fairly recent version of Spidermonkey. I use the version from HomeBrew which uses this url.
  2. R14A. Emonk uses the new NIF API extensively.

Building

Hopefully the build scenario is something like:

$ git clone git://github.com/davisp/emonk.git
$ cd emonk
$ make
$ make check

Running

I've been using etap to test as I code. Its awesome. You should use it. That said, running is pretty cake assuming emonk is on your Erlang code path:

$ ERL_LIBS=~/awesome_projects/emonk/src erl -s emonk
1> {ok, Context} = emonk:create_ctx().
{ok, <<>>} % Note: The <<>> here is *not* an empty binary. Its a resource.
2> emonk:eval(Context, <<"var f = 2; f*3;">>).
{ok, 6}
3> emonk:eval(Context, <<"var g = function(x) {return x*4;};">>).
{ok, undefined}
4> emonk:call(Context, <<"g">>, [9]).
{ok, 36}

Bugs and Things

The best place to file bugs is at the issue tracker on GitHub. Less yapping, more tapping. Thanks mattly.

Yep

That's pretty much it. Mostly this was internal churn that I kinda started chasing around like my tail. Hopefully things are easy enough to follow in the logs and code.

Something went wrong with that request. Please try again.