ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/DeviceMotionEvent.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from orientation-event (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.DeviceMotionEvent
(js_newDeviceMotionEvent, js_getAcceleration, js_getAccelerationIncludingGravity, js_getRotationRate, js_getInterval, newDeviceMotionEvent, getAcceleration, getAccelerationUnsafe, getAccelerationUnchecked, getAccelerationIncludingGravity, getAccelerationIncludingGravityUnsafe, getAccelerationIncludingGravityUnchecked, getRotationRate, getRotationRateUnsafe, getRotationRateUnchecked, getInterval, DeviceMotionEvent(..), gTypeDeviceMotionEvent)
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, $2) => { return new globalThis[\"DeviceMotionEvent\"]($1, $2); })"
js_newDeviceMotionEvent :: JSString -> JSVal -> IO DeviceMotionEvent
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/DeviceMotionEvent MDN DeviceMotionEvent. documentation>
newDeviceMotionEvent :: (MonadDOM m, ToJSString type') => type' -> Maybe DeviceMotionEventInit -> m DeviceMotionEvent
newDeviceMotionEvent type' eventInitDict = liftDOM (((P.maybe (P.return jsUndefined) toJSVal eventInitDict) >>= \a2' -> js_newDeviceMotionEvent (toJSString type') a2'))
foreign import javascript unsafe "(($1) => { return $1[\"acceleration\"]; })"
js_getAcceleration :: DeviceMotionEvent -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/acceleration MDN DeviceMotionEvent.acceleration documentation>
getAcceleration :: (MonadDOM m) => DeviceMotionEvent -> m (Maybe DeviceMotionEventAcceleration)
getAcceleration self = liftDOM (((js_getAcceleration (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/acceleration MDN DeviceMotionEvent.acceleration documentation>
getAccelerationUnsafe :: (MonadDOM m, HasCallStack) => DeviceMotionEvent -> m DeviceMotionEventAcceleration
getAccelerationUnsafe self = liftDOM ((((js_getAcceleration (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/acceleration MDN DeviceMotionEvent.acceleration documentation>
getAccelerationUnchecked :: (MonadDOM m) => DeviceMotionEvent -> m DeviceMotionEventAcceleration
getAccelerationUnchecked self = liftDOM ((pFromJSVal <$> (js_getAcceleration (self))))
foreign import javascript unsafe "(($1) => { return $1[\"accelerationIncludingGravity\"]; })"
js_getAccelerationIncludingGravity :: DeviceMotionEvent -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/accelerationIncludingGravity MDN DeviceMotionEvent.accelerationIncludingGravity documentation>
getAccelerationIncludingGravity :: (MonadDOM m) => DeviceMotionEvent -> m (Maybe DeviceMotionEventAcceleration)
getAccelerationIncludingGravity self = liftDOM (((js_getAccelerationIncludingGravity (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/accelerationIncludingGravity MDN DeviceMotionEvent.accelerationIncludingGravity documentation>
getAccelerationIncludingGravityUnsafe :: (MonadDOM m, HasCallStack) => DeviceMotionEvent -> m DeviceMotionEventAcceleration
getAccelerationIncludingGravityUnsafe self = liftDOM ((((js_getAccelerationIncludingGravity (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/accelerationIncludingGravity MDN DeviceMotionEvent.accelerationIncludingGravity documentation>
getAccelerationIncludingGravityUnchecked :: (MonadDOM m) => DeviceMotionEvent -> m DeviceMotionEventAcceleration
getAccelerationIncludingGravityUnchecked self = liftDOM ((pFromJSVal <$> (js_getAccelerationIncludingGravity (self))))
foreign import javascript unsafe "(($1) => { return $1[\"rotationRate\"]; })"
js_getRotationRate :: DeviceMotionEvent -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/rotationRate MDN DeviceMotionEvent.rotationRate documentation>
getRotationRate :: (MonadDOM m) => DeviceMotionEvent -> m (Maybe DeviceMotionEventRotationRate)
getRotationRate self = liftDOM (((js_getRotationRate (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/rotationRate MDN DeviceMotionEvent.rotationRate documentation>
getRotationRateUnsafe :: (MonadDOM m, HasCallStack) => DeviceMotionEvent -> m DeviceMotionEventRotationRate
getRotationRateUnsafe self = liftDOM ((((js_getRotationRate (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/rotationRate MDN DeviceMotionEvent.rotationRate documentation>
getRotationRateUnchecked :: (MonadDOM m) => DeviceMotionEvent -> m DeviceMotionEventRotationRate
getRotationRateUnchecked self = liftDOM ((pFromJSVal <$> (js_getRotationRate (self))))
foreign import javascript unsafe "(($1) => { return $1[\"interval\"]; })"
js_getInterval :: DeviceMotionEvent -> IO Double
-- | <https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/interval MDN DeviceMotionEvent.interval documentation>
getInterval :: (MonadDOM m) => DeviceMotionEvent -> m Double
getInterval self = liftDOM ((js_getInterval (self)))