ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/GeolocationCoordinates.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from geolocation (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.GeolocationCoordinates
(js_toJSON, js_getAccuracy, js_getLatitude, js_getLongitude, js_getAltitude, js_getAltitudeAccuracy, js_getHeading, js_getSpeed, toJSON, toJSON_, getAccuracy, getLatitude, getLongitude, getAltitude, getAltitudeUnsafe, getAltitudeUnchecked, getAltitudeAccuracy, getAltitudeAccuracyUnsafe, getAltitudeAccuracyUnchecked, getHeading, getHeadingUnsafe, getHeadingUnchecked, getSpeed, getSpeedUnsafe, getSpeedUnchecked, GeolocationCoordinates(..), gTypeGeolocationCoordinates)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(($1) => { return $1[\"toJSON\"](); })"
js_toJSON :: GeolocationCoordinates -> IO GObject
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/toJSON MDN GeolocationCoordinates.toJSON documentation>
toJSON :: (MonadDOM m) => GeolocationCoordinates -> m GObject
toJSON self = liftDOM ((js_toJSON (self)))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/toJSON MDN GeolocationCoordinates.toJSON documentation>
toJSON_ :: (MonadDOM m) => GeolocationCoordinates -> m ()
toJSON_ self = liftDOM (void ((js_toJSON (self))))
foreign import javascript unsafe "(($1) => { return $1[\"accuracy\"]; })"
js_getAccuracy :: GeolocationCoordinates -> IO Double
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/accuracy MDN GeolocationCoordinates.accuracy documentation>
getAccuracy :: (MonadDOM m) => GeolocationCoordinates -> m Double
getAccuracy self = liftDOM ((js_getAccuracy (self)))
foreign import javascript unsafe "(($1) => { return $1[\"latitude\"]; })"
js_getLatitude :: GeolocationCoordinates -> IO Double
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/latitude MDN GeolocationCoordinates.latitude documentation>
getLatitude :: (MonadDOM m) => GeolocationCoordinates -> m Double
getLatitude self = liftDOM ((js_getLatitude (self)))
foreign import javascript unsafe "(($1) => { return $1[\"longitude\"]; })"
js_getLongitude :: GeolocationCoordinates -> IO Double
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/longitude MDN GeolocationCoordinates.longitude documentation>
getLongitude :: (MonadDOM m) => GeolocationCoordinates -> m Double
getLongitude self = liftDOM ((js_getLongitude (self)))
foreign import javascript unsafe "(($1) => { return $1[\"altitude\"]; })"
js_getAltitude :: GeolocationCoordinates -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitude MDN GeolocationCoordinates.altitude documentation>
getAltitude :: (MonadDOM m) => GeolocationCoordinates -> m (Maybe Double)
getAltitude self = liftDOM (((js_getAltitude (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitude MDN GeolocationCoordinates.altitude documentation>
getAltitudeUnsafe :: (MonadDOM m, HasCallStack) => GeolocationCoordinates -> m Double
getAltitudeUnsafe self = liftDOM ((((js_getAltitude (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitude MDN GeolocationCoordinates.altitude documentation>
getAltitudeUnchecked :: (MonadDOM m) => GeolocationCoordinates -> m Double
getAltitudeUnchecked self = liftDOM ((pFromJSVal <$> (js_getAltitude (self))))
foreign import javascript unsafe "(($1) => { return $1[\"altitudeAccuracy\"]; })"
js_getAltitudeAccuracy :: GeolocationCoordinates -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitudeAccuracy MDN GeolocationCoordinates.altitudeAccuracy documentation>
getAltitudeAccuracy :: (MonadDOM m) => GeolocationCoordinates -> m (Maybe Double)
getAltitudeAccuracy self = liftDOM (((js_getAltitudeAccuracy (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitudeAccuracy MDN GeolocationCoordinates.altitudeAccuracy documentation>
getAltitudeAccuracyUnsafe :: (MonadDOM m, HasCallStack) => GeolocationCoordinates -> m Double
getAltitudeAccuracyUnsafe self = liftDOM ((((js_getAltitudeAccuracy (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitudeAccuracy MDN GeolocationCoordinates.altitudeAccuracy documentation>
getAltitudeAccuracyUnchecked :: (MonadDOM m) => GeolocationCoordinates -> m Double
getAltitudeAccuracyUnchecked self = liftDOM ((pFromJSVal <$> (js_getAltitudeAccuracy (self))))
foreign import javascript unsafe "(($1) => { return $1[\"heading\"]; })"
js_getHeading :: GeolocationCoordinates -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/heading MDN GeolocationCoordinates.heading documentation>
getHeading :: (MonadDOM m) => GeolocationCoordinates -> m (Maybe Double)
getHeading self = liftDOM (((js_getHeading (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/heading MDN GeolocationCoordinates.heading documentation>
getHeadingUnsafe :: (MonadDOM m, HasCallStack) => GeolocationCoordinates -> m Double
getHeadingUnsafe self = liftDOM ((((js_getHeading (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/heading MDN GeolocationCoordinates.heading documentation>
getHeadingUnchecked :: (MonadDOM m) => GeolocationCoordinates -> m Double
getHeadingUnchecked self = liftDOM ((pFromJSVal <$> (js_getHeading (self))))
foreign import javascript unsafe "(($1) => { return $1[\"speed\"]; })"
js_getSpeed :: GeolocationCoordinates -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/speed MDN GeolocationCoordinates.speed documentation>
getSpeed :: (MonadDOM m) => GeolocationCoordinates -> m (Maybe Double)
getSpeed self = liftDOM (((js_getSpeed (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/speed MDN GeolocationCoordinates.speed documentation>
getSpeedUnsafe :: (MonadDOM m, HasCallStack) => GeolocationCoordinates -> m Double
getSpeedUnsafe self = liftDOM ((((js_getSpeed (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/speed MDN GeolocationCoordinates.speed documentation>
getSpeedUnchecked :: (MonadDOM m) => GeolocationCoordinates -> m Double
getSpeedUnchecked self = liftDOM ((pFromJSVal <$> (js_getSpeed (self))))