module JSDOM.Generated.DeviceMotionEvent
(initDeviceMotionEvent, getAcceleration, getAccelerationUnsafe,
getAccelerationUnchecked, getAccelerationIncludingGravity,
getAccelerationIncludingGravityUnsafe,
getAccelerationIncludingGravityUnchecked, getRotationRate,
getRotationRateUnsafe, getRotationRateUnchecked, getInterval,
getIntervalUnsafe, getIntervalUnchecked, DeviceMotionEvent(..),
gTypeDeviceMotionEvent)
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 Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
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
initDeviceMotionEvent ::
(MonadDOM m, ToJSString type') =>
DeviceMotionEvent ->
Maybe type' ->
Bool ->
Bool ->
Maybe Acceleration ->
Maybe Acceleration -> Maybe RotationRate -> Maybe Double -> m ()
initDeviceMotionEvent self type' bubbles cancelable acceleration
accelerationIncludingGravity rotationRate interval
= liftDOM
(void
(self ^. jsf "initDeviceMotionEvent"
[toJSVal type', toJSVal bubbles, toJSVal cancelable,
toJSVal acceleration, toJSVal accelerationIncludingGravity,
toJSVal rotationRate, toJSVal interval]))
getAcceleration ::
(MonadDOM m) => DeviceMotionEvent -> m (Maybe Acceleration)
getAcceleration self
= liftDOM ((self ^. js "acceleration") >>= fromJSVal)
getAccelerationUnsafe ::
(MonadDOM m, HasCallStack) => DeviceMotionEvent -> m Acceleration
getAccelerationUnsafe self
= liftDOM
(((self ^. js "acceleration") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getAccelerationUnchecked ::
(MonadDOM m) => DeviceMotionEvent -> m Acceleration
getAccelerationUnchecked self
= liftDOM ((self ^. js "acceleration") >>= fromJSValUnchecked)
getAccelerationIncludingGravity ::
(MonadDOM m) => DeviceMotionEvent -> m (Maybe Acceleration)
getAccelerationIncludingGravity self
= liftDOM
((self ^. js "accelerationIncludingGravity") >>= fromJSVal)
getAccelerationIncludingGravityUnsafe ::
(MonadDOM m, HasCallStack) =>
DeviceMotionEvent -> m Acceleration
getAccelerationIncludingGravityUnsafe self
= liftDOM
(((self ^. js "accelerationIncludingGravity") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getAccelerationIncludingGravityUnchecked ::
(MonadDOM m) => DeviceMotionEvent -> m Acceleration
getAccelerationIncludingGravityUnchecked self
= liftDOM
((self ^. js "accelerationIncludingGravity") >>=
fromJSValUnchecked)
getRotationRate ::
(MonadDOM m) => DeviceMotionEvent -> m (Maybe RotationRate)
getRotationRate self
= liftDOM ((self ^. js "rotationRate") >>= fromJSVal)
getRotationRateUnsafe ::
(MonadDOM m, HasCallStack) => DeviceMotionEvent -> m RotationRate
getRotationRateUnsafe self
= liftDOM
(((self ^. js "rotationRate") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getRotationRateUnchecked ::
(MonadDOM m) => DeviceMotionEvent -> m RotationRate
getRotationRateUnchecked self
= liftDOM ((self ^. js "rotationRate") >>= fromJSValUnchecked)
getInterval ::
(MonadDOM m) => DeviceMotionEvent -> m (Maybe Double)
getInterval self = liftDOM ((self ^. js "interval") >>= fromJSVal)
getIntervalUnsafe ::
(MonadDOM m, HasCallStack) => DeviceMotionEvent -> m Double
getIntervalUnsafe self
= liftDOM
(((self ^. js "interval") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getIntervalUnchecked ::
(MonadDOM m) => DeviceMotionEvent -> m Double
getIntervalUnchecked self
= liftDOM ((self ^. js "interval") >>= fromJSValUnchecked)