View Source AFK.Keycode.MFA (afk v0.3.2)

MFA allows you to call arbitrary Elixir code from key presses.

Link to this section Summary

Link to this section Types

@type mfargs() :: {module(), atom()} | {module(), atom(), list()}
@type t() :: %AFK.Keycode.MFA{pressed_mfa: mfargs(), released_mfa: nil | mfargs()}

Link to this section Functions

Link to this function

new(pressed_mfa, released_mfa \\ nil)

View Source
@spec new(pressed_mfa :: mfargs(), released_mfa :: nil | mfargs()) :: t()

Creates an MFA keycode.

examples

Examples

In this example, the keycode will call MyMod.my_func/0 when pressed, and nothing when released.

iex> new({MyMod, :my_func})
%AFK.Keycode.MFA{pressed_mfa: {MyMod, :my_func}}