Skip to content

Instantly share code, notes, and snippets.

@jonte
Created January 25, 2011 15:54
Show Gist options
  • Save jonte/795103 to your computer and use it in GitHub Desktop.
Save jonte/795103 to your computer and use it in GitHub Desktop.
js_runner
-module(js_runner).
-export([executeJS/2, boot/0]).
boot() ->
erlang_js:start(),
{ok, Port} = js_driver:new(),
Port.
executeJS(Port, Data) ->
ok = js:define(Port, <<"function helloworld(name){return 'Hello, ' + name}">>),
js:call(Port, <<"helloworld">>, [list_to_binary(Data)]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment