jsaddle-dom-0.10.0.0: src/JSDOM/Generated/DeviceMotionEventAcceleration.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from orientation-event (webref). Do not edit.
module JSDOM.Generated.DeviceMotionEventAcceleration
(getX, getXUnsafe, getXUnchecked, getY, getYUnsafe, getYUnchecked, getZ, getZUnsafe, getZUnchecked, DeviceMotionEventAcceleration(..), gTypeDeviceMotionEventAcceleration)
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/DeviceMotionEventAcceleration/x MDN DeviceMotionEventAcceleration.x documentation>
getX :: (MonadDOM m) => DeviceMotionEventAcceleration -> m (Maybe Double)
getX self = liftDOM (((self ^. js "x") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/x MDN DeviceMotionEventAcceleration.x documentation>
getXUnsafe :: (MonadDOM m, HasCallStack) => DeviceMotionEventAcceleration -> m Double
getXUnsafe self = liftDOM ((((self ^. js "x") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/x MDN DeviceMotionEventAcceleration.x documentation>
getXUnchecked :: (MonadDOM m) => DeviceMotionEventAcceleration -> m Double
getXUnchecked self = liftDOM (((self ^. js "x") >>= valToNumber))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/y MDN DeviceMotionEventAcceleration.y documentation>
getY :: (MonadDOM m) => DeviceMotionEventAcceleration -> m (Maybe Double)
getY self = liftDOM (((self ^. js "y") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/y MDN DeviceMotionEventAcceleration.y documentation>
getYUnsafe :: (MonadDOM m, HasCallStack) => DeviceMotionEventAcceleration -> m Double
getYUnsafe self = liftDOM ((((self ^. js "y") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/y MDN DeviceMotionEventAcceleration.y documentation>
getYUnchecked :: (MonadDOM m) => DeviceMotionEventAcceleration -> m Double
getYUnchecked self = liftDOM (((self ^. js "y") >>= valToNumber))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/z MDN DeviceMotionEventAcceleration.z documentation>
getZ :: (MonadDOM m) => DeviceMotionEventAcceleration -> m (Maybe Double)
getZ self = liftDOM (((self ^. js "z") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/z MDN DeviceMotionEventAcceleration.z documentation>
getZUnsafe :: (MonadDOM m, HasCallStack) => DeviceMotionEventAcceleration -> m Double
getZUnsafe self = liftDOM ((((self ^. js "z") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/z MDN DeviceMotionEventAcceleration.z documentation>
getZUnchecked :: (MonadDOM m) => DeviceMotionEventAcceleration -> m Double
getZUnchecked self = liftDOM (((self ^. js "z") >>= valToNumber))