packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from uievents (webref). Do not edit.
module JSDOM.Generated.UIEventInit
       (newUIEventInit, setView, getView, getViewUnsafe, getViewUnchecked, setDetail, getDetail, getDetailUnsafe, getDetailUnchecked, setSourceCapabilities, getSourceCapabilities, getSourceCapabilitiesUnsafe, getSourceCapabilitiesUnchecked, setWhich, getWhich, getWhichUnsafe, getWhichUnchecked, UIEventInit(..), gTypeUIEventInit, IsUIEventInit, toUIEventInit)
       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://w3c.github.io/uievents/#dictdef-uieventinit UIEventInit specification>
newUIEventInit :: (MonadDOM m) => m UIEventInit
newUIEventInit = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-view UIEventInit.view specification>
setView :: (MonadDOM m, IsUIEventInit self) => self -> Maybe Window -> m ()
setView self val = liftDOM (void ((Types.toUIEventInit self) ^. jss "view" (toJSVal val)))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-view UIEventInit.view specification>
getView :: (MonadDOM m, IsUIEventInit self) => self -> m (Maybe Window)
getView self = liftDOM ((((Types.toUIEventInit self) ^. js "view") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-view UIEventInit.view specification>
getViewUnsafe :: (MonadDOM m, IsUIEventInit self, HasCallStack) => self -> m Window
getViewUnsafe self = liftDOM (((((Types.toUIEventInit self) ^. js "view") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-view UIEventInit.view specification>
getViewUnchecked :: (MonadDOM m, IsUIEventInit self) => self -> m Window
getViewUnchecked self = liftDOM ((((Types.toUIEventInit self) ^. js "view") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-detail UIEventInit.detail specification>
setDetail :: (MonadDOM m, IsUIEventInit self) => self -> Int -> m ()
setDetail self val = liftDOM (void ((Types.toUIEventInit self) ^. jss "detail" (toJSVal val)))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-detail UIEventInit.detail specification>
getDetail :: (MonadDOM m, IsUIEventInit self) => self -> m (Maybe Int)
getDetail self = liftDOM ((((Types.toUIEventInit self) ^. js "detail") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-detail UIEventInit.detail specification>
getDetailUnsafe :: (MonadDOM m, IsUIEventInit self, HasCallStack) => self -> m Int
getDetailUnsafe self = liftDOM (((((Types.toUIEventInit self) ^. js "detail") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-detail UIEventInit.detail specification>
getDetailUnchecked :: (MonadDOM m, IsUIEventInit self) => self -> m Int
getDetailUnchecked self = liftDOM ((P.round <$> (((Types.toUIEventInit self) ^. js "detail") >>= valToNumber)))

-- | <https://wicg.github.io/input-device-capabilities/#dom-uieventinit-sourcecapabilities UIEventInit.sourceCapabilities specification>
setSourceCapabilities :: (MonadDOM m, IsUIEventInit self) => self -> Maybe InputDeviceCapabilities -> m ()
setSourceCapabilities self val = liftDOM (void ((Types.toUIEventInit self) ^. jss "sourceCapabilities" (toJSVal val)))

-- | <https://wicg.github.io/input-device-capabilities/#dom-uieventinit-sourcecapabilities UIEventInit.sourceCapabilities specification>
getSourceCapabilities :: (MonadDOM m, IsUIEventInit self) => self -> m (Maybe InputDeviceCapabilities)
getSourceCapabilities self = liftDOM ((((Types.toUIEventInit self) ^. js "sourceCapabilities") >>= fromJSValUnchecked))

-- | <https://wicg.github.io/input-device-capabilities/#dom-uieventinit-sourcecapabilities UIEventInit.sourceCapabilities specification>
getSourceCapabilitiesUnsafe :: (MonadDOM m, IsUIEventInit self, HasCallStack) => self -> m InputDeviceCapabilities
getSourceCapabilitiesUnsafe self = liftDOM (((((Types.toUIEventInit self) ^. js "sourceCapabilities") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://wicg.github.io/input-device-capabilities/#dom-uieventinit-sourcecapabilities UIEventInit.sourceCapabilities specification>
getSourceCapabilitiesUnchecked :: (MonadDOM m, IsUIEventInit self) => self -> m InputDeviceCapabilities
getSourceCapabilitiesUnchecked self = liftDOM ((((Types.toUIEventInit self) ^. js "sourceCapabilities") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-which UIEventInit.which specification>
setWhich :: (MonadDOM m, IsUIEventInit self) => self -> Word -> m ()
setWhich self val = liftDOM (void ((Types.toUIEventInit self) ^. jss "which" (toJSVal val)))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-which UIEventInit.which specification>
getWhich :: (MonadDOM m, IsUIEventInit self) => self -> m (Maybe Word)
getWhich self = liftDOM ((((Types.toUIEventInit self) ^. js "which") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-which UIEventInit.which specification>
getWhichUnsafe :: (MonadDOM m, IsUIEventInit self, HasCallStack) => self -> m Word
getWhichUnsafe self = liftDOM (((((Types.toUIEventInit self) ^. js "which") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-which UIEventInit.which specification>
getWhichUnchecked :: (MonadDOM m, IsUIEventInit self) => self -> m Word
getWhichUnchecked self = liftDOM ((P.round <$> (((Types.toUIEventInit self) ^. js "which") >>= valToNumber)))