{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE JavaScriptFFI #-} -- For HasCallStack compatibility {-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-} module GHCJS.DOM.JSFFI.Generated.Gamepad (js_getId, getId, js_getIndex, getIndex, js_getConnected, getConnected, js_getTimestamp, getTimestamp, js_getMapping, getMapping, js_getAxes, getAxes, js_getButtons, getButtons, Gamepad(..), gTypeGamepad) where import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, fmap, Show, Read, Eq, Ord) import qualified Prelude (error) import Data.Typeable (Typeable) import GHCJS.Types (JSVal(..), JSString) import GHCJS.Foreign (jsNull, jsUndefined) import GHCJS.Foreign.Callback (syncCallback, asyncCallback, syncCallback1, asyncCallback1, syncCallback2, asyncCallback2, OnBlocked(..)) import GHCJS.Marshal (ToJSVal(..), FromJSVal(..)) import GHCJS.Marshal.Pure (PToJSVal(..), PFromJSVal(..)) import Control.Monad (void) import Control.Monad.IO.Class (MonadIO(..)) import Data.Int (Int64) import Data.Word (Word, Word64) import Data.Maybe (fromJust) import Data.Traversable (mapM) import GHCJS.DOM.Types import Control.Applicative ((<$>)) import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync) import GHCJS.DOM.JSFFI.Generated.Enums foreign import javascript unsafe "$1[\"id\"]" js_getId :: Gamepad -> IO JSString -- | getId :: (MonadIO m, FromJSString result) => Gamepad -> m result getId self = liftIO (fromJSString <$> (js_getId self)) foreign import javascript unsafe "$1[\"index\"]" js_getIndex :: Gamepad -> IO Word -- | getIndex :: (MonadIO m) => Gamepad -> m Word getIndex self = liftIO (js_getIndex self) foreign import javascript unsafe "($1[\"connected\"] ? 1 : 0)" js_getConnected :: Gamepad -> IO Bool -- | getConnected :: (MonadIO m) => Gamepad -> m Bool getConnected self = liftIO (js_getConnected self) foreign import javascript unsafe "$1[\"timestamp\"]" js_getTimestamp :: Gamepad -> IO Double -- | getTimestamp :: (MonadIO m) => Gamepad -> m Double getTimestamp self = liftIO (js_getTimestamp self) foreign import javascript unsafe "$1[\"mapping\"]" js_getMapping :: Gamepad -> IO JSString -- | getMapping :: (MonadIO m, FromJSString result) => Gamepad -> m result getMapping self = liftIO (fromJSString <$> (js_getMapping self)) foreign import javascript unsafe "$1[\"axes\"]" js_getAxes :: Gamepad -> IO JSVal -- | getAxes :: (MonadIO m) => Gamepad -> m [Double] getAxes self = liftIO ((js_getAxes self) >>= fromJSValUnchecked) foreign import javascript unsafe "$1[\"buttons\"]" js_getButtons :: Gamepad -> IO JSVal -- | getButtons :: (MonadIO m) => Gamepad -> m [GamepadButton] getButtons self = liftIO ((js_getButtons self) >>= fromJSValUnchecked)