Pebble.Events
Generic watch-side event subscriptions.
Each helper turns a platform event into a regular Elm Sub msg. Use batch to combine time ticks with other Pebble subscriptions.
import Pebble.Events as Events
type Msg
= MinuteChanged Int
| HourChanged Int
subscriptions _ =
Events.batch
[ Events.onMinuteChange MinuteChanged
, Events.onHourChange HourChanged
]
Watchfaces often use onMinuteChange to refresh the clock each minute.
Native Pebble C API
- TickTimerService on developer.repebble.com
Time
onSecondChange
onSecondChange : (Int -> msg) -> Sub msgReceive the current second whenever the local second changes.
The value is the current wall-clock second, from 0 to 59.
onMinuteChange
onMinuteChange : (Int -> msg) -> Sub msgReceive a message when the local minute changes.
The value is the current wall-clock minute, from 0 to 59.
onHourChange
onHourChange : (Int -> msg) -> Sub msgReceive a message when the local hour changes.
The value is the current wall-clock hour, from 0 to 23.
onDayChange
onDayChange : (Int -> msg) -> Sub msgReceive a message when the local day of month changes.
The value is the current day of month, from 1 to 31.
onMonthChange
onMonthChange : (Int -> msg) -> Sub msgReceive a message when the local month changes.
The value is the current month number, from 1 to 12.
onYearChange
onYearChange : (Int -> msg) -> Sub msgReceive a message when the local year changes.
The value is the current full year, for example 2026.
Animation
onAnimationFinished
onAnimationFinished : (AnimationId -> msg) -> Sub msgReceive a message when a drawVectorSequenceAt or drawBitmapSequenceAt instance finishes playing.
The runtime passes the AnimationId from the draw call. Use a fresh id for each new play so replays and multiple on-screen instances stay independent.
Composition
batch
batch : List (Sub msg) -> Sub msgCombine multiple Pebble subscriptions into one.