packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/UIEventInit.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from uievents (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.UIEventInit
       (js_newUIEventInit, js_setView, js_getView, js_setDetail, js_getDetail, js_setSourceCapabilities, js_getSourceCapabilities, js_setWhich, js_getWhich, 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 GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript safe "(() => { return ({}); })"
        js_newUIEventInit :: IO UIEventInit
-- | <https://w3c.github.io/uievents/#dictdef-uieventinit UIEventInit specification>
newUIEventInit :: (MonadDOM m) => m UIEventInit
newUIEventInit = liftDOM ((js_newUIEventInit))

foreign import javascript safe "(($1, $2) => { $1[\"view\"] = $2; })"
        js_setView :: UIEventInit -> JSVal -> IO ()
-- | <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 (((toJSVal val) >>= \a2' -> js_setView ((Types.toUIEventInit self)) a2')))

foreign import javascript unsafe "(($1) => { return $1[\"view\"]; })"
        js_getView :: UIEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-uieventinit-view UIEventInit.view specification>
getView :: (MonadDOM m, IsUIEventInit self) => self -> m (Maybe Window)
getView self = liftDOM (((js_getView ((Types.toUIEventInit self))) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-view UIEventInit.view specification>
getViewUnsafe :: (MonadDOM m, IsUIEventInit self, HasCallStack) => self -> m Window
getViewUnsafe self = liftDOM ((((js_getView ((Types.toUIEventInit self))) >>= 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 ((pFromJSVal <$> (js_getView ((Types.toUIEventInit self)))))

foreign import javascript safe "(($1, $2) => { $1[\"detail\"] = $2; })"
        js_setDetail :: UIEventInit -> Int -> IO ()
-- | <https://w3c.github.io/uievents/#dom-uieventinit-detail UIEventInit.detail specification>
setDetail :: (MonadDOM m, IsUIEventInit self) => self -> Int -> m ()
setDetail self val = liftDOM (void ((js_setDetail ((Types.toUIEventInit self)) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"detail\"]; })"
        js_getDetail :: UIEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-uieventinit-detail UIEventInit.detail specification>
getDetail :: (MonadDOM m, IsUIEventInit self) => self -> m (Maybe Int)
getDetail self = liftDOM (((js_getDetail ((Types.toUIEventInit self))) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-detail UIEventInit.detail specification>
getDetailUnsafe :: (MonadDOM m, IsUIEventInit self, HasCallStack) => self -> m Int
getDetailUnsafe self = liftDOM ((((js_getDetail ((Types.toUIEventInit self))) >>= 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 ((pFromJSVal <$> (js_getDetail ((Types.toUIEventInit self)))))

foreign import javascript safe "(($1, $2) => { $1[\"sourceCapabilities\"] = $2; })"
        js_setSourceCapabilities :: UIEventInit -> JSVal -> IO ()
-- | <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 (((toJSVal val) >>= \a2' -> js_setSourceCapabilities ((Types.toUIEventInit self)) a2')))

foreign import javascript unsafe "(($1) => { return $1[\"sourceCapabilities\"]; })"
        js_getSourceCapabilities :: UIEventInit -> IO JSVal
-- | <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 (((js_getSourceCapabilities ((Types.toUIEventInit self))) >>= 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 ((((js_getSourceCapabilities ((Types.toUIEventInit self))) >>= 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 ((pFromJSVal <$> (js_getSourceCapabilities ((Types.toUIEventInit self)))))

foreign import javascript safe "(($1, $2) => { $1[\"which\"] = $2; })"
        js_setWhich :: UIEventInit -> Word -> IO ()
-- | <https://w3c.github.io/uievents/#dom-uieventinit-which UIEventInit.which specification>
setWhich :: (MonadDOM m, IsUIEventInit self) => self -> Word -> m ()
setWhich self val = liftDOM (void ((js_setWhich ((Types.toUIEventInit self)) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"which\"]; })"
        js_getWhich :: UIEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-uieventinit-which UIEventInit.which specification>
getWhich :: (MonadDOM m, IsUIEventInit self) => self -> m (Maybe Word)
getWhich self = liftDOM (((js_getWhich ((Types.toUIEventInit self))) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-uieventinit-which UIEventInit.which specification>
getWhichUnsafe :: (MonadDOM m, IsUIEventInit self, HasCallStack) => self -> m Word
getWhichUnsafe self = liftDOM ((((js_getWhich ((Types.toUIEventInit self))) >>= 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 ((pFromJSVal <$> (js_getWhich ((Types.toUIEventInit self)))))