plinth/browser/geolocation

Types

pub type GeolocationPosition {
  GeolocationPosition(
    latitude: Float,
    longitude: Float,
    altitude: Option(Float),
    accuracy: Float,
    altitude_accuracy: Option(Float),
    heading: Option(Float),
    speed: Option(Float),
    timestamp: Float,
  )
}

Constructors

  • GeolocationPosition(
      latitude: Float,
      longitude: Float,
      altitude: Option(Float),
      accuracy: Float,
      altitude_accuracy: Option(Float),
      heading: Option(Float),
      speed: Option(Float),
      timestamp: Float,
    )
pub type JSGeolocationPosition
pub type JSGeolocationPositionError

Functions

pub fn current_position() -> Promise(
  Result(GeolocationPosition, String),
)
pub fn decode(
  raw: Dynamic,
) -> Result(GeolocationPosition, List(DecodeError))
pub fn get_current_position(
  success: fn(JSGeolocationPosition) -> Nil,
  error: fn(JSGeolocationPositionError) -> Nil,
) -> Nil
Search Document