Skip to content

Function: reconstructPomodoroState()

function reconstructPomodoroState(
timer,
totalElapsed,
settings): {
phase: "focus" | "short-break" | "long-break";
phaseStartTime: number;
sessionsCompleted: number;
};

Defined in: shared/src/helper/pomodoroHelper/pomodoroFunctions.ts:99

Reconstruct Pomodoro state after browser refresh Calculates which phase the timer should be in based on total elapsed time

ParameterType
timer{ appointment_id: string | null; created_at: string; delta_end_time: number; delta_start_time: number; id: string; memo: string | null; order_index: number; pomodoro_enabled: boolean; pomodoro_focus_duration: number | null; pomodoro_long_break_duration: number | null; pomodoro_phase: "focus" | "short-break" | "long-break"; pomodoro_phase_overtime: boolean; pomodoro_phase_start_time: string | null; pomodoro_sessions_completed: number; pomodoro_sessions_until_long_break: number | null; pomodoro_short_break_duration: number | null; round_in_time_fragments: boolean | null; rounding_direction: "up" | "down" | "nearest" | null; rounding_interval: number | null; start_time: string | null; state: "running" | "stopped"; time_fragment_interval: number | null; user_id: string; work_project_id: string; }
timer.appointment_idstring | null
timer.created_atstring
timer.delta_end_timenumber
timer.delta_start_timenumber
timer.idstring
timer.memostring | null
timer.order_indexnumber
timer.pomodoro_enabledboolean
timer.pomodoro_focus_durationnumber | null
timer.pomodoro_long_break_durationnumber | null
timer.pomodoro_phase"focus" | "short-break" | "long-break"
timer.pomodoro_phase_overtimeboolean
timer.pomodoro_phase_start_timestring | null
timer.pomodoro_sessions_completednumber
timer.pomodoro_sessions_until_long_breaknumber | null
timer.pomodoro_short_break_durationnumber | null
timer.round_in_time_fragmentsboolean | null
timer.rounding_direction"up" | "down" | "nearest" | null
timer.rounding_intervalnumber | null
timer.start_timestring | null
timer.state"running" | "stopped"
timer.time_fragment_intervalnumber | null
timer.user_idstring
timer.work_project_idstring
totalElapsednumber
settingsPomodoroSettings
{
phase: "focus" | "short-break" | "long-break";
phaseStartTime: number;
sessionsCompleted: number;
}
NameTypeDefined in
phase"focus" | "short-break" | "long-break"shared/src/helper/pomodoroHelper/pomodoroFunctions.ts:104
phaseStartTimenumbershared/src/helper/pomodoroHelper/pomodoroFunctions.ts:105
sessionsCompletednumbershared/src/helper/pomodoroHelper/pomodoroFunctions.ts:106