Reverted to erlang_js
This commit is contained in:
parent
4965013fc9
commit
dcab797d0f
4 changed files with 21 additions and 14 deletions
|
@ -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]).
|
||||
|
|
Reference in a new issue