{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.DeviceOrientationEvent
(initDeviceOrientationEvent, getAlpha, getAlphaUnsafe,
getAlphaUnchecked, getBeta, getBetaUnsafe, getBetaUnchecked,
getGamma, getGammaUnsafe, getGammaUnchecked, getAbsolute,
getAbsoluteUnsafe, getAbsoluteUnchecked,
DeviceOrientationEvent(..), gTypeDeviceOrientationEvent)
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, unsafeEventNameAsync)
import JSDOM.Enums
initDeviceOrientationEvent ::
(MonadDOM m, ToJSString type') =>
DeviceOrientationEvent ->
Maybe type' ->
Bool ->
Bool ->
Maybe Double ->
Maybe Double -> Maybe Double -> Maybe Bool -> m ()
initDeviceOrientationEvent :: forall (m :: * -> *) type'.
(MonadDOM m, ToJSString type') =>
DeviceOrientationEvent
-> Maybe type'
-> Bool
-> Bool
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Bool
-> m ()
initDeviceOrientationEvent DeviceOrientationEvent
self Maybe type'
type' Bool
bubbles Bool
cancelable Maybe Double
alpha Maybe Double
beta
Maybe Double
gamma Maybe Bool
absolute
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
(DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> [JSM JSVal] -> JSF
forall name args.
(ToJSString name, MakeArgs args) =>
name -> args -> JSF
jsf String
"initDeviceOrientationEvent"
[Maybe type' -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe type'
type', Bool -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Bool
bubbles, Bool -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Bool
cancelable, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
alpha,
Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
beta, Maybe Double -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Double
gamma, Maybe Bool -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Bool
absolute]))
getAlpha ::
(MonadDOM m) => DeviceOrientationEvent -> m (Maybe Double)
getAlpha :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m (Maybe Double)
getAlpha DeviceOrientationEvent
self = DOM (Maybe Double) -> m (Maybe Double)
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"alpha") JSM JSVal -> (JSVal -> DOM (Maybe Double)) -> DOM (Maybe Double)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Double)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal)
getAlphaUnsafe ::
(MonadDOM m, HasCallStack) => DeviceOrientationEvent -> m Double
getAlphaUnsafe :: forall (m :: * -> *).
(MonadDOM m, HasCallStack) =>
DeviceOrientationEvent -> m Double
getAlphaUnsafe DeviceOrientationEvent
self
= DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"alpha") JSM JSVal -> (JSVal -> DOM (Maybe Double)) -> DOM (Maybe Double)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Double)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal) DOM (Maybe Double) -> (Maybe Double -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
DOM Double -> (Double -> DOM Double) -> Maybe Double -> DOM Double
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> DOM Double
forall a. HasCallStack => String -> a
Prelude.error String
"Nothing to return") Double -> DOM Double
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return)
getAlphaUnchecked ::
(MonadDOM m) => DeviceOrientationEvent -> m Double
getAlphaUnchecked :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m Double
getAlphaUnchecked DeviceOrientationEvent
self
= DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"alpha") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getBeta ::
(MonadDOM m) => DeviceOrientationEvent -> m (Maybe Double)
getBeta :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m (Maybe Double)
getBeta DeviceOrientationEvent
self = DOM (Maybe Double) -> m (Maybe Double)
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"beta") JSM JSVal -> (JSVal -> DOM (Maybe Double)) -> DOM (Maybe Double)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Double)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal)
getBetaUnsafe ::
(MonadDOM m, HasCallStack) => DeviceOrientationEvent -> m Double
getBetaUnsafe :: forall (m :: * -> *).
(MonadDOM m, HasCallStack) =>
DeviceOrientationEvent -> m Double
getBetaUnsafe DeviceOrientationEvent
self
= DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"beta") JSM JSVal -> (JSVal -> DOM (Maybe Double)) -> DOM (Maybe Double)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Double)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal) DOM (Maybe Double) -> (Maybe Double -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
DOM Double -> (Double -> DOM Double) -> Maybe Double -> DOM Double
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> DOM Double
forall a. HasCallStack => String -> a
Prelude.error String
"Nothing to return") Double -> DOM Double
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return)
getBetaUnchecked ::
(MonadDOM m) => DeviceOrientationEvent -> m Double
getBetaUnchecked :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m Double
getBetaUnchecked DeviceOrientationEvent
self
= DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"beta") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getGamma ::
(MonadDOM m) => DeviceOrientationEvent -> m (Maybe Double)
getGamma :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m (Maybe Double)
getGamma DeviceOrientationEvent
self = DOM (Maybe Double) -> m (Maybe Double)
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"gamma") JSM JSVal -> (JSVal -> DOM (Maybe Double)) -> DOM (Maybe Double)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Double)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal)
getGammaUnsafe ::
(MonadDOM m, HasCallStack) => DeviceOrientationEvent -> m Double
getGammaUnsafe :: forall (m :: * -> *).
(MonadDOM m, HasCallStack) =>
DeviceOrientationEvent -> m Double
getGammaUnsafe DeviceOrientationEvent
self
= DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"gamma") JSM JSVal -> (JSVal -> DOM (Maybe Double)) -> DOM (Maybe Double)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Double)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal) DOM (Maybe Double) -> (Maybe Double -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
DOM Double -> (Double -> DOM Double) -> Maybe Double -> DOM Double
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> DOM Double
forall a. HasCallStack => String -> a
Prelude.error String
"Nothing to return") Double -> DOM Double
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return)
getGammaUnchecked ::
(MonadDOM m) => DeviceOrientationEvent -> m Double
getGammaUnchecked :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m Double
getGammaUnchecked DeviceOrientationEvent
self
= DOM Double -> m Double
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"gamma") JSM JSVal -> (JSVal -> DOM Double) -> DOM Double
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Double
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getAbsolute ::
(MonadDOM m) => DeviceOrientationEvent -> m (Maybe Bool)
getAbsolute :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m (Maybe Bool)
getAbsolute DeviceOrientationEvent
self = DOM (Maybe Bool) -> m (Maybe Bool)
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"absolute") JSM JSVal -> (JSVal -> DOM (Maybe Bool)) -> DOM (Maybe Bool)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Bool)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal)
getAbsoluteUnsafe ::
(MonadDOM m, HasCallStack) => DeviceOrientationEvent -> m Bool
getAbsoluteUnsafe :: forall (m :: * -> *).
(MonadDOM m, HasCallStack) =>
DeviceOrientationEvent -> m Bool
getAbsoluteUnsafe DeviceOrientationEvent
self
= DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"absolute") JSM JSVal -> (JSVal -> DOM (Maybe Bool)) -> DOM (Maybe Bool)
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM (Maybe Bool)
forall a. FromJSVal a => JSVal -> JSM (Maybe a)
fromJSVal) DOM (Maybe Bool) -> (Maybe Bool -> DOM Bool) -> DOM Bool
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
DOM Bool -> (Bool -> DOM Bool) -> Maybe Bool -> DOM Bool
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> DOM Bool
forall a. HasCallStack => String -> a
Prelude.error String
"Nothing to return") Bool -> DOM Bool
forall a. a -> JSM a
forall (m :: * -> *) a. Monad m => a -> m a
return)
getAbsoluteUnchecked ::
(MonadDOM m) => DeviceOrientationEvent -> m Bool
getAbsoluteUnchecked :: forall (m :: * -> *).
MonadDOM m =>
DeviceOrientationEvent -> m Bool
getAbsoluteUnchecked DeviceOrientationEvent
self
= DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((DeviceOrientationEvent
self DeviceOrientationEvent
-> Getting (JSM JSVal) DeviceOrientationEvent (JSM JSVal)
-> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter DeviceOrientationEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"absolute") JSM JSVal -> (JSVal -> DOM Bool) -> DOM Bool
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM Bool
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)