Packages

High Mountains is a Gleam library for working with Alpine JS through Lustre attributes.

Current section

Files

Jump to
high_mountains src high_mountains@event_modifier.erl
Raw

src/high_mountains@event_modifier.erl

-module(high_mountains@event_modifier).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/high_mountains/event_modifier.gleam").
-export([to_string/1]).
-export_type([event_modifier/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-type event_modifier() :: prevent |
stop |
outside |
window |
document |
once |
{debounce, gleam@option:option(integer())} |
{throttle, gleam@option:option(integer())} |
self |
camel |
dot |
passive |
capture.
-file("src/high_mountains/event_modifier.gleam", 21).
?DOC(false).
-spec to_string(event_modifier()) -> binary().
to_string(Mod) ->
case Mod of
prevent ->
<<".prevent"/utf8>>;
stop ->
<<".stop"/utf8>>;
outside ->
<<".outside"/utf8>>;
window ->
<<".window"/utf8>>;
document ->
<<".document"/utf8>>;
once ->
<<".once"/utf8>>;
{debounce, none} ->
<<".debounce"/utf8>>;
{debounce, {some, Ms}} ->
<<<<".debounce."/utf8, (erlang:integer_to_binary(Ms))/binary>>/binary,
"ms"/utf8>>;
{throttle, none} ->
<<".throttle"/utf8>>;
{throttle, {some, Ms@1}} ->
<<<<".throttle."/utf8, (erlang:integer_to_binary(Ms@1))/binary>>/binary,
"ms"/utf8>>;
self ->
<<".self"/utf8>>;
camel ->
<<".camel"/utf8>>;
dot ->
<<".dot"/utf8>>;
passive ->
<<".passive"/utf8>>;
capture ->
<<".capture"/utf8>>
end.