action_wire.erl 474 B

123456789101112131415161718192021222324
  1. -module(action_wire).
  2. %%-author('Maxim Sokhatsky').
  3. -include_lib("nitro/include/nitro.hrl").
  4. -include_lib("nitro/include/event.hrl").
  5. -export([
  6. render_action/1,
  7. wire/1
  8. ]).
  9. render_action( #wire{actions = Actions} ) -> nitro:render(Actions);
  10. render_action(S) when erlang:is_list(S) -> S;
  11. render_action(_) -> [].
  12. wire(A) ->
  13. Actions = case erlang:get(actions) of
  14. undefined -> [];
  15. E -> E
  16. end,
  17. erlang:put(actions, Actions ++ [ #wire{actions = A} ]),
  18. [].