Created
January 2, 2020 21:02
-
-
Save neslinesli93/afdd5fd634b75e0a1ef4a3e9fc8c55fa to your computer and use it in GitHub Desktop.
Make event handlers functional
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@spec handle_event(String.t(), map(), Socket.t()) :: {:noreply, Socket.t()} | {:stop, Socket.t()} | |
def handle_event("keydown", %{"code" => code}, socket) do | |
{:noreply, on_input(socket, code)} | |
end | |
def handle_event("keyup", %{"code" => code}, socket) do | |
{:noreply, on_stop_input(socket, code)} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment