View Source ExPomodoro.PomodoroServer (ExPomodoro v1.0.0)
The Pomodoro Server implementation
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Given a pid, returns the current state.
Given a keyword of args returns a new map that represents the Elixir.ExPomodoro.PomodoroServer state.
Given a pid, pauses a pomodoro and returns the current pomodoro state.
Given a pid, resumes a pomodoro and returns the current pomodoro state.
Given a keyword of arguments, starts a Elixir.GenServer process linked to the current process.
Link to this section Types
@type init_args() :: [ id: ExPomodoro.Pomodoro.id(), exercise: non_neg_integer(), break: non_neg_integer(), rounds: non_neg_integer() ]
@type state() :: %{ activity_ref: reference() | nil, callback_module: module(), id: ExPomodoro.Pomodoro.id(), pomodoro: ExPomodoro.Pomodoro.t(), previous_activity: ExPomodoro.Pomodoro.activity() | nil, previous_activity_timeleft: non_neg_integer() | nil, timeout: non_neg_integer(), timeout_ref: reference() | nil }
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec get_state(pid()) :: ExPomodoro.Pomodoro.t()
Given a pid, returns the current state.
Given a keyword of args returns a new map that represents the Elixir.ExPomodoro.PomodoroServer state.
Given a pid, pauses a pomodoro and returns the current pomodoro state.
@spec resume(pid()) :: {:ok, ExPomodoro.Pomodoro.t()}
Given a pid, resumes a pomodoro and returns the current pomodoro state.
Given a keyword of arguments, starts a Elixir.GenServer process linked to the current process.
args
Args:
id
: (required) unique string to identify a pomodoro struct.exercise
: (optional) an integer that represents the duration of the time spent on exercise in milliseconds.break
: (optional) an integer that represents the break duration in milliseconds.rounds
: (optional) an integer that represents the amount of rounds until the pomodoro stops.timeout
: (optional) milliseconds until the server is terminated by inactiviy.