packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/TouchEvent.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from touch-events (webref). Do not edit.
module JSDOM.Generated.TouchEvent
       (newTouchEvent, getTouches, getTargetTouches, getChangedTouches, getAltKey, getMetaKey, getCtrlKey, getShiftKey, TouchEvent(..), gTypeTouchEvent)
       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/TouchEvent/TouchEvent MDN TouchEvent. documentation>
newTouchEvent :: (MonadDOM m, ToJSString type') => type' -> Maybe TouchEventInit -> m TouchEvent
newTouchEvent type' eventInitDict = liftDOM (((new (jsg "TouchEvent") [toJSVal type', P.maybe (P.return jsUndefined) toJSVal eventInitDict]) >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/TouchEvent/touches MDN TouchEvent.touches documentation>
getTouches :: (MonadDOM m) => TouchEvent -> m TouchList
getTouches self = liftDOM (((self ^. js "touches") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/TouchEvent/targetTouches MDN TouchEvent.targetTouches documentation>
getTargetTouches :: (MonadDOM m) => TouchEvent -> m TouchList
getTargetTouches self = liftDOM (((self ^. js "targetTouches") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/TouchEvent/changedTouches MDN TouchEvent.changedTouches documentation>
getChangedTouches :: (MonadDOM m) => TouchEvent -> m TouchList
getChangedTouches self = liftDOM (((self ^. js "changedTouches") >>= fromJSValUnchecked))

-- | <https://developer.mozilla.org/docs/Web/API/TouchEvent/altKey MDN TouchEvent.altKey documentation>
getAltKey :: (MonadDOM m) => TouchEvent -> m Bool
getAltKey self = liftDOM (((self ^. js "altKey") >>= valToBool))

-- | <https://developer.mozilla.org/docs/Web/API/TouchEvent/metaKey MDN TouchEvent.metaKey documentation>
getMetaKey :: (MonadDOM m) => TouchEvent -> m Bool
getMetaKey self = liftDOM (((self ^. js "metaKey") >>= valToBool))

-- | <https://developer.mozilla.org/docs/Web/API/TouchEvent/ctrlKey MDN TouchEvent.ctrlKey documentation>
getCtrlKey :: (MonadDOM m) => TouchEvent -> m Bool
getCtrlKey self = liftDOM (((self ^. js "ctrlKey") >>= valToBool))

-- | <https://developer.mozilla.org/docs/Web/API/TouchEvent/shiftKey MDN TouchEvent.shiftKey documentation>
getShiftKey :: (MonadDOM m) => TouchEvent -> m Bool
getShiftKey self = liftDOM (((self ^. js "shiftKey") >>= valToBool))