packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GeolocationPosition.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from geolocation (webref). Do not edit.
module JSDOM.Generated.GeolocationPosition
       (toJSON, toJSON_, getCoords, getTimestamp, GeolocationPosition(..), gTypeGeolocationPosition)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums

-- | <https://developer.mozilla.org/docs/Web/API/GeolocationPosition/toJSON MDN GeolocationPosition.toJSON documentation>
toJSON :: (MonadDOM m) => GeolocationPosition -> m GObject
toJSON self = liftDOM (((self ^. jsf "toJSON" ()) >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/GeolocationPosition/toJSON MDN GeolocationPosition.toJSON documentation>
toJSON_ :: (MonadDOM m) => GeolocationPosition -> m ()
toJSON_ self = liftDOM (void (self ^. jsf "toJSON" ()))

-- | <https://developer.mozilla.org/docs/Web/API/GeolocationPosition/coords MDN GeolocationPosition.coords documentation>
getCoords :: (MonadDOM m) => GeolocationPosition -> m GeolocationCoordinates
getCoords self = liftDOM (((self ^. js "coords") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/GeolocationPosition/timestamp MDN GeolocationPosition.timestamp documentation>
getTimestamp :: (MonadDOM m) => GeolocationPosition -> m Word53
getTimestamp self = liftDOM (((self ^. js "timestamp") >>= fromJSValUnchecked))