Reverted to erlang_js

This commit is contained in:
Jonatan Pålsson 2011-01-30 14:14:33 +01:00
parent 4965013fc9
commit dcab797d0f
4 changed files with 21 additions and 14 deletions

View file

@ -1,11 +1,13 @@
-module(js_runner).
-export([executeJS/2, boot/0]).
-export([define/2,call/3, 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)]).
define(Port, Data) ->
ok = js:define(Port, list_to_binary(Data)).
call(Port, Func, Params) ->
js:call(Port, list_to_binary(Func), [Params]).