Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

60 wiersze
1.5 KiB

  1. -module({{eventid}}).
  2. -behaviour(gen_event).
  3. %% ------------------------------------------------------------------
  4. %% API Function Exports
  5. %% ------------------------------------------------------------------
  6. -export([start_link/0,
  7. add_handler/2]).
  8. %% ------------------------------------------------------------------
  9. %% gen_event Function Exports
  10. %% ------------------------------------------------------------------
  11. -export([init/1,
  12. handle_event/2,
  13. handle_call/2,
  14. handle_info/2,
  15. terminate/2,
  16. code_change/3]).
  17. -record(state, {}).
  18. %% ------------------------------------------------------------------
  19. %% API Function Definitions
  20. %% ------------------------------------------------------------------
  21. start_link() ->
  22. gen_event:start_link({local, ?MODULE}).
  23. add_handler(Handler, Args) ->
  24. gen_event:add_handler(?MODULE, Handler, Args).
  25. %% ------------------------------------------------------------------
  26. %% gen_event Function Definitions
  27. %% ------------------------------------------------------------------
  28. init([]) ->
  29. {ok, #state{}}.
  30. handle_event(_Event, State) ->
  31. {ok, State}.
  32. handle_call(_Request, State) ->
  33. Reply = ok,
  34. {ok, Reply, State}.
  35. handle_info(_Info, State) ->
  36. {ok, State}.
  37. terminate(_Reason, _State) ->
  38. ok.
  39. code_change(_OldVsn, State, _Extra) ->
  40. {ok, State}.
  41. %% ------------------------------------------------------------------
  42. %% Internal Function Definitions
  43. %% ------------------------------------------------------------------