Now we can run javascript and send back the return values
This commit is contained in:
parent
c88dcf7829
commit
b1a65ef0ac
8 changed files with 10 additions and 3 deletions
|
@ -1,7 +1,11 @@
|
|||
-module(js_runner).
|
||||
-export([run/0]).
|
||||
-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">>, [<<"Generic Game Server">>]).
|
||||
js:call(Port, <<"helloworld">>, [Data]).
|
||||
|
|
Reference in a new issue