jsaddle-dom-0.10.0.0: src/JSDOM/Generated/FocusOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module JSDOM.Generated.FocusOptions
(newFocusOptions, setPreventScroll, getPreventScroll, getPreventScrollUnsafe, getPreventScrollUnchecked, setFocusVisible, getFocusVisible, getFocusVisibleUnsafe, getFocusVisibleUnchecked, FocusOptions(..), gTypeFocusOptions)
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://html.spec.whatwg.org/multipage/interaction.html#focusoptions FocusOptions specification>
newFocusOptions :: (MonadDOM m) => m FocusOptions
newFocusOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-preventscroll FocusOptions.preventScroll specification>
setPreventScroll :: (MonadDOM m) => FocusOptions -> Bool -> m ()
setPreventScroll self val = liftDOM (void (self ^. jss "preventScroll" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-preventscroll FocusOptions.preventScroll specification>
getPreventScroll :: (MonadDOM m) => FocusOptions -> m (Maybe Bool)
getPreventScroll self = liftDOM (((self ^. js "preventScroll") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-preventscroll FocusOptions.preventScroll specification>
getPreventScrollUnsafe :: (MonadDOM m, HasCallStack) => FocusOptions -> m Bool
getPreventScrollUnsafe self = liftDOM ((((self ^. js "preventScroll") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-preventscroll FocusOptions.preventScroll specification>
getPreventScrollUnchecked :: (MonadDOM m) => FocusOptions -> m Bool
getPreventScrollUnchecked self = liftDOM (((self ^. js "preventScroll") >>= valToBool))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-focusvisible FocusOptions.focusVisible specification>
setFocusVisible :: (MonadDOM m) => FocusOptions -> Bool -> m ()
setFocusVisible self val = liftDOM (void (self ^. jss "focusVisible" (toJSVal val)))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-focusvisible FocusOptions.focusVisible specification>
getFocusVisible :: (MonadDOM m) => FocusOptions -> m (Maybe Bool)
getFocusVisible self = liftDOM (((self ^. js "focusVisible") >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-focusvisible FocusOptions.focusVisible specification>
getFocusVisibleUnsafe :: (MonadDOM m, HasCallStack) => FocusOptions -> m Bool
getFocusVisibleUnsafe self = liftDOM ((((self ^. js "focusVisible") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/interaction.html#dom-focusoptions-focusvisible FocusOptions.focusVisible specification>
getFocusVisibleUnchecked :: (MonadDOM m) => FocusOptions -> m Bool
getFocusVisibleUnchecked self = liftDOM (((self ^. js "focusVisible") >>= valToBool))