packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from cssom-view-1 (webref). Do not edit.
module JSDOM.Generated.ScrollIntoViewOptions
       (newScrollIntoViewOptions, setBlock, getBlock, getBlockUnsafe, getBlockUnchecked, setInline, getInline, getInlineUnsafe, getInlineUnchecked, setContainer, getContainer, getContainerUnsafe, getContainerUnchecked, ScrollIntoViewOptions(..), gTypeScrollIntoViewOptions)
       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://drafts.csswg.org/cssom-view-1/#dictdef-scrollintoviewoptions ScrollIntoViewOptions specification>
newScrollIntoViewOptions :: (MonadDOM m) => m ScrollIntoViewOptions
newScrollIntoViewOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-block ScrollIntoViewOptions.block specification>
setBlock :: (MonadDOM m) => ScrollIntoViewOptions -> ScrollLogicalPosition -> m ()
setBlock self val = liftDOM (void (self ^. jss "block" (toJSVal val)))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-block ScrollIntoViewOptions.block specification>
getBlock :: (MonadDOM m) => ScrollIntoViewOptions -> m (Maybe ScrollLogicalPosition)
getBlock self = liftDOM (((self ^. js "block") >>= fromJSValUnchecked))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-block ScrollIntoViewOptions.block specification>
getBlockUnsafe :: (MonadDOM m, HasCallStack) => ScrollIntoViewOptions -> m ScrollLogicalPosition
getBlockUnsafe self = liftDOM ((((self ^. js "block") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-block ScrollIntoViewOptions.block specification>
getBlockUnchecked :: (MonadDOM m) => ScrollIntoViewOptions -> m ScrollLogicalPosition
getBlockUnchecked self = liftDOM (((self ^. js "block") >>= fromJSValUnchecked))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-inline ScrollIntoViewOptions.inline specification>
setInline :: (MonadDOM m) => ScrollIntoViewOptions -> ScrollLogicalPosition -> m ()
setInline self val = liftDOM (void (self ^. jss "inline" (toJSVal val)))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-inline ScrollIntoViewOptions.inline specification>
getInline :: (MonadDOM m) => ScrollIntoViewOptions -> m (Maybe ScrollLogicalPosition)
getInline self = liftDOM (((self ^. js "inline") >>= fromJSValUnchecked))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-inline ScrollIntoViewOptions.inline specification>
getInlineUnsafe :: (MonadDOM m, HasCallStack) => ScrollIntoViewOptions -> m ScrollLogicalPosition
getInlineUnsafe self = liftDOM ((((self ^. js "inline") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-inline ScrollIntoViewOptions.inline specification>
getInlineUnchecked :: (MonadDOM m) => ScrollIntoViewOptions -> m ScrollLogicalPosition
getInlineUnchecked self = liftDOM (((self ^. js "inline") >>= fromJSValUnchecked))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-container ScrollIntoViewOptions.container specification>
setContainer :: (MonadDOM m) => ScrollIntoViewOptions -> ScrollIntoViewContainer -> m ()
setContainer self val = liftDOM (void (self ^. jss "container" (toJSVal val)))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-container ScrollIntoViewOptions.container specification>
getContainer :: (MonadDOM m) => ScrollIntoViewOptions -> m (Maybe ScrollIntoViewContainer)
getContainer self = liftDOM (((self ^. js "container") >>= fromJSValUnchecked))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-container ScrollIntoViewOptions.container specification>
getContainerUnsafe :: (MonadDOM m, HasCallStack) => ScrollIntoViewOptions -> m ScrollIntoViewContainer
getContainerUnsafe self = liftDOM ((((self ^. js "container") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://drafts.csswg.org/cssom-view-1/#dom-scrollintoviewoptions-container ScrollIntoViewOptions.container specification>
getContainerUnchecked :: (MonadDOM m) => ScrollIntoViewOptions -> m ScrollIntoViewContainer
getContainerUnchecked self = liftDOM (((self ^. js "container") >>= fromJSValUnchecked))