Raxol.Terminal.Events (Raxol v2.0.1)

View Source

Global event management for terminal interactions.

This module provides a centralized event system for handling global terminal events such as clicks, keyboard input, and other user interactions that need to be processed at the application level.

Summary

Functions

Returns a specification to start this module under a supervisor.

Registers a global click handler that will be called whenever a click occurs.

Triggers a click event at the given position.

Unregisters a previously registered click handler.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

handle_manager_info(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.

register_global_click(handler)

@spec register_global_click(function()) :: {:ok, reference()}

Registers a global click handler that will be called whenever a click occurs.

Parameters

  • handler - A function that takes a click position and handles the event

Examples

Raxol.Terminal.Events.register_global_click(fn {x, y} ->
  Log.info("Clicked at #{x}, #{y}")
end)

start_link(init_opts \\ [])

trigger_click(position)

@spec trigger_click({integer(), integer()}) :: :ok

Triggers a click event at the given position.

This will call all registered click handlers.

unregister_global_click(ref)

@spec unregister_global_click(reference()) :: :ok

Unregisters a previously registered click handler.

Parameters

  • ref - The reference returned from register_global_click