Skip to content

Reference

tilttek/turn-clock

Every public type of the package, with its role. The types marked internal may change in any version.

Clocks

TypeRole
TurnClockThe service: create, start, pass, check, pause, resume, vacations, adjust, stop and view.
TableClockA clock: its time control, its players in seat order, the turn in progress and its version.
PlayerClockOne player's time: budget, what is left, turns, time spent and vacations.
TimeControlThe budget, the mode and increment, and the overtime.
ModeFischer, Bronstein, a delay, or the whole budget per turn.
OvertimeCounted below zero, or forfeited.
VacationA span during which a player's clock does not run.
View\ClockViewThe clock to show the table, and when the turn runs out.
View\PlayerTimeOne player's time at a moment.

Ports and stores

TypeRole
Contract\ClockStoreKeeps the clocks at a version.
Contract\ClockObserverTold of the events of a clock.
Store\InMemoryClockStoreThe clocks in memory, for tests.

Events

TypeRole
Event\ClockEventEvery event: the clock.
Event\PlayerEventThe events of one player: the clock and the player.
Event\ClockStartedA clock was started.
Event\TurnStartedA player's turn started.
Event\TurnEndedA player's turn ended.
Event\TimeExpiredA player's budget ran out.
Event\ClockPausedA clock was paused.
Event\ClockResumedA clock runs again.
Event\VacationDeclaredA player declared a vacation.
Event\TimeAdjustedA player's time was changed.
Event\ClockStoppedA clock was stopped.

Exceptions

TypeRole
Exception\TurnClockExceptionEvery exception of the library.
Exception\InvalidClockA value out of its shape or its bounds.
Exception\ClockRefusedA change the clock does not allow.
Exception\ClockNotFoundNo clock or player has the identifier.
Exception\ClockConflictThe clock changed since it was read.

Internal

TypeRole
Internal\IdentifierThe shape of an identifier.
Internal\MillisInstants as milliseconds since the epoch.