{-# LANGUAGE PatternSynonyms #-} module Language.Javascript.JSaddle.DOM.Generated.UIEvent (initUIEvent, getView, getDetail, getKeyCode, getCharCode, getLayerX, getLayerY, getPageX, getPageY, getWhich, UIEvent, castToUIEvent, gTypeUIEvent, IsUIEvent, toUIEvent) where import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..)) import Data.Typeable (Typeable) import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, new, array) import Data.Int (Int64) import Data.Word (Word, Word64) import Language.Javascript.JSaddle.DOM.Types import Control.Applicative ((<$>)) import Control.Monad (void) import Control.Lens.Operators ((^.)) import Language.Javascript.JSaddle.DOM.Enums -- | initUIEvent :: (MonadDOM m, IsUIEvent self, ToJSString type') => self -> type' -> Bool -> Bool -> Maybe Window -> Int -> m () initUIEvent self type' canBubble cancelable view detail = liftDOM (void ((toUIEvent self) ^. jsf "initUIEvent" [toJSVal type', toJSVal canBubble, toJSVal cancelable, toJSVal view, toJSVal detail])) -- | getView :: (MonadDOM m, IsUIEvent self) => self -> m (Maybe Window) getView self = liftDOM (((toUIEvent self) ^. js "view") >>= fromJSVal) -- | getDetail :: (MonadDOM m, IsUIEvent self) => self -> m Int getDetail self = liftDOM (round <$> (((toUIEvent self) ^. js "detail") >>= valToNumber)) -- | getKeyCode :: (MonadDOM m, IsUIEvent self) => self -> m Int getKeyCode self = liftDOM (round <$> (((toUIEvent self) ^. js "keyCode") >>= valToNumber)) -- | getCharCode :: (MonadDOM m, IsUIEvent self) => self -> m Int getCharCode self = liftDOM (round <$> (((toUIEvent self) ^. js "charCode") >>= valToNumber)) -- | getLayerX :: (MonadDOM m, IsUIEvent self) => self -> m Int getLayerX self = liftDOM (round <$> (((toUIEvent self) ^. js "layerX") >>= valToNumber)) -- | getLayerY :: (MonadDOM m, IsUIEvent self) => self -> m Int getLayerY self = liftDOM (round <$> (((toUIEvent self) ^. js "layerY") >>= valToNumber)) -- | getPageX :: (MonadDOM m, IsUIEvent self) => self -> m Int getPageX self = liftDOM (round <$> (((toUIEvent self) ^. js "pageX") >>= valToNumber)) -- | getPageY :: (MonadDOM m, IsUIEvent self) => self -> m Int getPageY self = liftDOM (round <$> (((toUIEvent self) ^. js "pageY") >>= valToNumber)) -- | getWhich :: (MonadDOM m, IsUIEvent self) => self -> m Int getWhich self = liftDOM (round <$> (((toUIEvent self) ^. js "which") >>= valToNumber))