{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.TouchEvent
(newTouchEvent, initTouchEvent, getTouches, getTargetTouches,
getChangedTouches, getCtrlKey, getShiftKey, getAltKey, getMetaKey,
TouchEvent(..), gTypeTouchEvent)
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
newTouchEvent ::
(MonadDOM m, ToJSString type') =>
type' -> Maybe TouchEventInit -> m TouchEvent
newTouchEvent :: forall (m :: * -> *) type'.
(MonadDOM m, ToJSString type') =>
type' -> Maybe TouchEventInit -> m TouchEvent
newTouchEvent type'
type' Maybe TouchEventInit
eventInitDict
= DOM TouchEvent -> m TouchEvent
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSVal -> TouchEvent
TouchEvent (JSVal -> TouchEvent) -> JSM JSVal -> DOM TouchEvent
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
JSM JSVal -> [JSM JSVal] -> JSM JSVal
forall constructor args.
(MakeObject constructor, MakeArgs args) =>
constructor -> args -> JSM JSVal
new (String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"TouchEvent") [type' -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal type'
type', Maybe TouchEventInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe TouchEventInit
eventInitDict])
initTouchEvent ::
(MonadDOM m, ToJSString type') =>
TouchEvent ->
Maybe TouchList ->
Maybe TouchList ->
Maybe TouchList ->
Maybe type' ->
Maybe Window ->
Maybe Int ->
Maybe Int ->
Maybe Int -> Maybe Int -> Bool -> Bool -> Bool -> Bool -> m ()
initTouchEvent :: forall (m :: * -> *) type'.
(MonadDOM m, ToJSString type') =>
TouchEvent
-> Maybe TouchList
-> Maybe TouchList
-> Maybe TouchList
-> Maybe type'
-> Maybe Window
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Bool
-> Bool
-> Bool
-> Bool
-> m ()
initTouchEvent TouchEvent
self Maybe TouchList
touches Maybe TouchList
targetTouches Maybe TouchList
changedTouches Maybe type'
type' Maybe Window
view
Maybe Int
screenX Maybe Int
screenY Maybe Int
clientX Maybe Int
clientY Bool
ctrlKey Bool
altKey Bool
shiftKey Bool
metaKey
= DOM () -> m ()
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(JSM JSVal -> DOM ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void
(TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (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
"initTouchEvent"
[Maybe TouchList -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe TouchList
touches, Maybe TouchList -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe TouchList
targetTouches, Maybe TouchList -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe TouchList
changedTouches,
Maybe type' -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe type'
type', Maybe Window -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Window
view, Maybe Int -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Int
screenX, Maybe Int -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Int
screenY,
Maybe Int -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Int
clientX, Maybe Int -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Maybe Int
clientY, Bool -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Bool
ctrlKey, Bool -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Bool
altKey,
Bool -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Bool
shiftKey, Bool -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal Bool
metaKey]))
getTouches :: (MonadDOM m) => TouchEvent -> m TouchList
getTouches :: forall (m :: * -> *). MonadDOM m => TouchEvent -> m TouchList
getTouches TouchEvent
self
= DOM TouchList -> m TouchList
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter TouchEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"touches") JSM JSVal -> (JSVal -> DOM TouchList) -> DOM TouchList
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 TouchList
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getTargetTouches :: (MonadDOM m) => TouchEvent -> m TouchList
getTargetTouches :: forall (m :: * -> *). MonadDOM m => TouchEvent -> m TouchList
getTargetTouches TouchEvent
self
= DOM TouchList -> m TouchList
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter TouchEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"targetTouches") JSM JSVal -> (JSVal -> DOM TouchList) -> DOM TouchList
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 TouchList
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getChangedTouches :: (MonadDOM m) => TouchEvent -> m TouchList
getChangedTouches :: forall (m :: * -> *). MonadDOM m => TouchEvent -> m TouchList
getChangedTouches TouchEvent
self
= DOM TouchList -> m TouchList
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter TouchEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"changedTouches") JSM JSVal -> (JSVal -> DOM TouchList) -> DOM TouchList
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 TouchList
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)
getCtrlKey :: (MonadDOM m) => TouchEvent -> m Bool
getCtrlKey :: forall (m :: * -> *). MonadDOM m => TouchEvent -> m Bool
getCtrlKey TouchEvent
self = DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter TouchEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"ctrlKey") 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 value. ToJSVal value => value -> DOM Bool
valToBool)
getShiftKey :: (MonadDOM m) => TouchEvent -> m Bool
getShiftKey :: forall (m :: * -> *). MonadDOM m => TouchEvent -> m Bool
getShiftKey TouchEvent
self = DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter TouchEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"shiftKey") 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 value. ToJSVal value => value -> DOM Bool
valToBool)
getAltKey :: (MonadDOM m) => TouchEvent -> m Bool
getAltKey :: forall (m :: * -> *). MonadDOM m => TouchEvent -> m Bool
getAltKey TouchEvent
self = DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter TouchEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"altKey") 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 value. ToJSVal value => value -> DOM Bool
valToBool)
getMetaKey :: (MonadDOM m) => TouchEvent -> m Bool
getMetaKey :: forall (m :: * -> *). MonadDOM m => TouchEvent -> m Bool
getMetaKey TouchEvent
self = DOM Bool -> m Bool
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((TouchEvent
self TouchEvent
-> Getting (JSM JSVal) TouchEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter TouchEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"metaKey") 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 value. ToJSVal value => value -> DOM Bool
valToBool)