Copyright | (c) 2015 Altera Praxis Pty Ltd |
---|---|
License | BSD |
Maintainer | eocallaghan@alterapraxis.com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This module encapsulates Fay Javascript for the GeoPosition API specified as in the W3C spec.
- geoPositionErrorMessage :: GeoPositionError -> String
- geoPositionErrorCode :: GeoPositionError -> GeoPositionErrorCode
- initGeoPosition :: GeoPositionCallbacks Fay -> Maybe GeoPositionOptions -> Fay ()
- data GeoPositionCallbacks m = GeoPositionCallbacks {
- geoPositionCallback :: GeoPosition -> m ()
- geoPositionErrorCallback :: Maybe (GeoPositionError -> m ())
- data GeoPositionOptions = GeoPositionOptions {
- enableHighAccuracy :: Bool
- timeout :: Int
- maximumAge :: Int
- data GeoPosition = GeoPosition {
- coords :: GeoCoordinates
- timestamp :: UTCTime
- data GeoCoordinates = GeoCoordinates {}
- data GeoPositionError = GeoPositionError {}
- data GeoPositionErrorCode
Documentation
geoPositionErrorMessage :: GeoPositionError -> String
Helper function extracts UTC-16 encoded error message
geoPositionErrorCode :: GeoPositionError -> GeoPositionErrorCode
Helper function decodes enumerated error code
into the GeoPositionErrorCode
type
initGeoPosition :: GeoPositionCallbacks Fay -> Maybe GeoPositionOptions -> Fay ()
Call to initialise GeoPosition API with callback actions to be taken upon success or error.
data GeoPositionCallbacks m
See section [5.1 - W3C Geolocation API] Requires the monad type that the callbacks have action on
GeoPositionCallbacks | |
|
data GeoPositionOptions
See section [5.2 - W3C Geolocation API]
GeoPositionOptions | |
|
data GeoPosition
See section [5.3 - W3C Geolocation API]
GeoPosition | |
|
data GeoPositionError
See section [5.5 - W3C Geolocation API]
GeoPositionError | |
|
data GeoPositionErrorCode
N.B. Fay does not support the Enum type class :(
Thus, use the geoPositionErrorCode
function to decode the value to the
GeoPositionErrorCode
type.
PermissionDenied | The acquisition of the geolocation information failed because the page didn't have the permission to do it. |
PositionUnavailable | The acquisition of the geolocation failed because at least one internal source of position returned an internal error. |
Timeout | The time allowed to acquire the geolocation, defined by |
Unknown | Out of spec error code |