Pebble.Companion.Battery
Phone battery helpers for companion apps.
init _ =
( model, Battery.current GotBattery )
subscriptions _ =
Battery.onBattery GotBatteryTypes
BatteryInfo
type alias BatteryInfo =
{ percent : Int
, charging : Bool
}Current phone battery charge and charging state.
Commands
current
current : (Result String BatteryInfo -> msg) -> Cmd msgRequest the current phone battery status.
setup
setup : Cmd msgRegister the battery platform handler with the companion bridge.
Subscriptions
onBattery
onBattery : (Result String BatteryInfo -> msg) -> Sub msgReceive pushed battery status updates from the companion bridge.
Registering this subscription also tells the bridge to send battery updates.