module JSDOM.Generated.Geoposition
(getCoords, getCoordsUnsafe, getCoordsUnchecked, getTimestamp,
Geoposition(..), gTypeGeoposition)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, new, array)
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName)
import JSDOM.Enums
getCoords :: (MonadDOM m) => Geoposition -> m (Maybe Coordinates)
getCoords self = liftDOM ((self ^. js "coords") >>= fromJSVal)
getCoordsUnsafe ::
(MonadDOM m, HasCallStack) => Geoposition -> m Coordinates
getCoordsUnsafe self
= liftDOM
(((self ^. js "coords") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getCoordsUnchecked :: (MonadDOM m) => Geoposition -> m Coordinates
getCoordsUnchecked self
= liftDOM ((self ^. js "coords") >>= fromJSValUnchecked)
getTimestamp :: (MonadDOM m) => Geoposition -> m Word
getTimestamp self
= liftDOM (round <$> ((self ^. js "timestamp") >>= valToNumber))