Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetProvider ¶
func SetProvider(p Provider)
Types ¶
type BatteryInfo ¶
type BatteryInfo struct {
Level float64 `json:"level"`
Charging bool `json:"charging"`
ChargingTime float64 `json:"chargingTime"`
DischargingTime float64 `json:"dischargingTime"`
}
BatteryInfo mirrors the web Battery Status API: Level is 0..1, and the time fields are seconds with -1 meaning unknown.
func GetBatteryInfo ¶
func GetBatteryInfo() (*BatteryInfo, error)
type Provider ¶
type Provider interface {
GetBatteryInfo() (*BatteryInfo, error)
}
Provider is a native battery backend. On mobile the shell registers one via SetProvider; on desktop the built-in platform implementation is used when no provider is set.
Click to show internal directories.
Click to hide internal directories.