packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/KeyboardEventInit.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.KeyboardEventInit
       (js_newKeyboardEventInit, js_setKey, js_getKey, js_setCode, js_getCode, js_setLocation, js_getLocation, js_setRepeat, js_getRepeat, js_setIsComposing, js_getIsComposing, js_setCharCode, js_getCharCode, js_setKeyCode, js_getKeyCode, newKeyboardEventInit, setKey, getKey, getKeyUnsafe, getKeyUnchecked, setCode, getCode, getCodeUnsafe, getCodeUnchecked, setLocation, getLocation, getLocationUnsafe, getLocationUnchecked, setRepeat, getRepeat, getRepeatUnsafe, getRepeatUnchecked, setIsComposing, getIsComposing, getIsComposingUnsafe, getIsComposingUnchecked, setCharCode, getCharCode, getCharCodeUnsafe, getCharCodeUnchecked, setKeyCode, getKeyCode, getKeyCodeUnsafe, getKeyCodeUnchecked, KeyboardEventInit(..), gTypeKeyboardEventInit)
       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_newKeyboardEventInit :: IO KeyboardEventInit
-- | <https://w3c.github.io/uievents/#dictdef-keyboardeventinit KeyboardEventInit specification>
newKeyboardEventInit :: (MonadDOM m) => m KeyboardEventInit
newKeyboardEventInit = liftDOM ((js_newKeyboardEventInit))

foreign import javascript safe "(($1, $2) => { $1[\"key\"] = $2; })"
        js_setKey :: KeyboardEventInit -> JSString -> IO ()
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-key KeyboardEventInit.key specification>
setKey :: (MonadDOM m, ToJSString val) => KeyboardEventInit -> val -> m ()
setKey self val = liftDOM (void ((js_setKey (self) (toJSString val))))

foreign import javascript unsafe "(($1) => { return $1[\"key\"]; })"
        js_getKey :: KeyboardEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-key KeyboardEventInit.key specification>
getKey :: (MonadDOM m, FromJSString result) => KeyboardEventInit -> m (Maybe result)
getKey self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getKey (self))))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-key KeyboardEventInit.key specification>
getKeyUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => KeyboardEventInit -> m result
getKeyUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getKey (self))) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-key KeyboardEventInit.key specification>
getKeyUnchecked :: (MonadDOM m, FromJSString result) => KeyboardEventInit -> m result
getKeyUnchecked self = liftDOM ((pFromJSVal <$> (js_getKey (self))))

foreign import javascript safe "(($1, $2) => { $1[\"code\"] = $2; })"
        js_setCode :: KeyboardEventInit -> JSString -> IO ()
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-code KeyboardEventInit.code specification>
setCode :: (MonadDOM m, ToJSString val) => KeyboardEventInit -> val -> m ()
setCode self val = liftDOM (void ((js_setCode (self) (toJSString val))))

foreign import javascript unsafe "(($1) => { return $1[\"code\"]; })"
        js_getCode :: KeyboardEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-code KeyboardEventInit.code specification>
getCode :: (MonadDOM m, FromJSString result) => KeyboardEventInit -> m (Maybe result)
getCode self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getCode (self))))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-code KeyboardEventInit.code specification>
getCodeUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => KeyboardEventInit -> m result
getCodeUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getCode (self))) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-code KeyboardEventInit.code specification>
getCodeUnchecked :: (MonadDOM m, FromJSString result) => KeyboardEventInit -> m result
getCodeUnchecked self = liftDOM ((pFromJSVal <$> (js_getCode (self))))

foreign import javascript safe "(($1, $2) => { $1[\"location\"] = $2; })"
        js_setLocation :: KeyboardEventInit -> Word -> IO ()
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-location KeyboardEventInit.location specification>
setLocation :: (MonadDOM m) => KeyboardEventInit -> Word -> m ()
setLocation self val = liftDOM (void ((js_setLocation (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"location\"]; })"
        js_getLocation :: KeyboardEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-location KeyboardEventInit.location specification>
getLocation :: (MonadDOM m) => KeyboardEventInit -> m (Maybe Word)
getLocation self = liftDOM (((js_getLocation (self)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-location KeyboardEventInit.location specification>
getLocationUnsafe :: (MonadDOM m, HasCallStack) => KeyboardEventInit -> m Word
getLocationUnsafe self = liftDOM ((((js_getLocation (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-location KeyboardEventInit.location specification>
getLocationUnchecked :: (MonadDOM m) => KeyboardEventInit -> m Word
getLocationUnchecked self = liftDOM ((pFromJSVal <$> (js_getLocation (self))))

foreign import javascript safe "(($1, $2) => { $1[\"repeat\"] = $2; })"
        js_setRepeat :: KeyboardEventInit -> Bool -> IO ()
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-repeat KeyboardEventInit.repeat specification>
setRepeat :: (MonadDOM m) => KeyboardEventInit -> Bool -> m ()
setRepeat self val = liftDOM (void ((js_setRepeat (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"repeat\"]; })"
        js_getRepeat :: KeyboardEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-repeat KeyboardEventInit.repeat specification>
getRepeat :: (MonadDOM m) => KeyboardEventInit -> m (Maybe Bool)
getRepeat self = liftDOM (((js_getRepeat (self)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-repeat KeyboardEventInit.repeat specification>
getRepeatUnsafe :: (MonadDOM m, HasCallStack) => KeyboardEventInit -> m Bool
getRepeatUnsafe self = liftDOM ((((js_getRepeat (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-repeat KeyboardEventInit.repeat specification>
getRepeatUnchecked :: (MonadDOM m) => KeyboardEventInit -> m Bool
getRepeatUnchecked self = liftDOM ((pFromJSVal <$> (js_getRepeat (self))))

foreign import javascript safe "(($1, $2) => { $1[\"isComposing\"] = $2; })"
        js_setIsComposing :: KeyboardEventInit -> Bool -> IO ()
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-iscomposing KeyboardEventInit.isComposing specification>
setIsComposing :: (MonadDOM m) => KeyboardEventInit -> Bool -> m ()
setIsComposing self val = liftDOM (void ((js_setIsComposing (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"isComposing\"]; })"
        js_getIsComposing :: KeyboardEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-iscomposing KeyboardEventInit.isComposing specification>
getIsComposing :: (MonadDOM m) => KeyboardEventInit -> m (Maybe Bool)
getIsComposing self = liftDOM (((js_getIsComposing (self)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-iscomposing KeyboardEventInit.isComposing specification>
getIsComposingUnsafe :: (MonadDOM m, HasCallStack) => KeyboardEventInit -> m Bool
getIsComposingUnsafe self = liftDOM ((((js_getIsComposing (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-iscomposing KeyboardEventInit.isComposing specification>
getIsComposingUnchecked :: (MonadDOM m) => KeyboardEventInit -> m Bool
getIsComposingUnchecked self = liftDOM ((pFromJSVal <$> (js_getIsComposing (self))))

foreign import javascript safe "(($1, $2) => { $1[\"charCode\"] = $2; })"
        js_setCharCode :: KeyboardEventInit -> Word -> IO ()
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-charcode KeyboardEventInit.charCode specification>
setCharCode :: (MonadDOM m) => KeyboardEventInit -> Word -> m ()
setCharCode self val = liftDOM (void ((js_setCharCode (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"charCode\"]; })"
        js_getCharCode :: KeyboardEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-charcode KeyboardEventInit.charCode specification>
getCharCode :: (MonadDOM m) => KeyboardEventInit -> m (Maybe Word)
getCharCode self = liftDOM (((js_getCharCode (self)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-charcode KeyboardEventInit.charCode specification>
getCharCodeUnsafe :: (MonadDOM m, HasCallStack) => KeyboardEventInit -> m Word
getCharCodeUnsafe self = liftDOM ((((js_getCharCode (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-charcode KeyboardEventInit.charCode specification>
getCharCodeUnchecked :: (MonadDOM m) => KeyboardEventInit -> m Word
getCharCodeUnchecked self = liftDOM ((pFromJSVal <$> (js_getCharCode (self))))

foreign import javascript safe "(($1, $2) => { $1[\"keyCode\"] = $2; })"
        js_setKeyCode :: KeyboardEventInit -> Word -> IO ()
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-keycode KeyboardEventInit.keyCode specification>
setKeyCode :: (MonadDOM m) => KeyboardEventInit -> Word -> m ()
setKeyCode self val = liftDOM (void ((js_setKeyCode (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"keyCode\"]; })"
        js_getKeyCode :: KeyboardEventInit -> IO JSVal
-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-keycode KeyboardEventInit.keyCode specification>
getKeyCode :: (MonadDOM m) => KeyboardEventInit -> m (Maybe Word)
getKeyCode self = liftDOM (((js_getKeyCode (self)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-keycode KeyboardEventInit.keyCode specification>
getKeyCodeUnsafe :: (MonadDOM m, HasCallStack) => KeyboardEventInit -> m Word
getKeyCodeUnsafe self = liftDOM ((((js_getKeyCode (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/uievents/#dom-keyboardeventinit-keycode KeyboardEventInit.keyCode specification>
getKeyCodeUnchecked :: (MonadDOM m) => KeyboardEventInit -> m Word
getKeyCodeUnchecked self = liftDOM ((pFromJSVal <$> (js_getKeyCode (self))))