Skip to content

Instantly share code, notes, and snippets.

@jonte
Created January 27, 2011 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonte/797851 to your computer and use it in GitHub Desktop.
Save jonte/797851 to your computer and use it in GitHub Desktop.
v8test.erl
-module(v8test).
-export([run/0]).
-include_lib("erlv8/include/erlv8.hrl").
run() ->
application:start(erlv8),
{ok, VM} = erlv8_vm:start(),
Global = erlv8_vm:global(VM),
Global:set_value("callback", erlv8_object:new([{"exec", fun (#erlv8_fun_invocation{}, []) -> myCallback() end}])),
erlv8_vm:run(VM,"callback.exec();").
myCallback() ->
io:format("Hello from myCallback!~n", []),
ok.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment