packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/ShowPopoverOptions.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.ShowPopoverOptions
       (newShowPopoverOptions, setSource, getSource, getSourceUnsafe, getSourceUnchecked, ShowPopoverOptions(..), gTypeShowPopoverOptions, IsShowPopoverOptions, toShowPopoverOptions)
       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/dom.html#showpopoveroptions ShowPopoverOptions specification>
newShowPopoverOptions :: (MonadDOM m) => m ShowPopoverOptions
newShowPopoverOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://html.spec.whatwg.org/multipage/dom.html#dom-showpopoveroptions-source ShowPopoverOptions.source specification>
setSource :: (MonadDOM m, IsShowPopoverOptions self, IsHTMLElement val) => self -> val -> m ()
setSource self val = liftDOM (void ((Types.toShowPopoverOptions self) ^. jss "source" (toJSVal val)))

-- | <https://html.spec.whatwg.org/multipage/dom.html#dom-showpopoveroptions-source ShowPopoverOptions.source specification>
getSource :: (MonadDOM m, IsShowPopoverOptions self) => self -> m (Maybe HTMLElement)
getSource self = liftDOM ((((Types.toShowPopoverOptions self) ^. js "source") >>= fromJSValUnchecked))

-- | <https://html.spec.whatwg.org/multipage/dom.html#dom-showpopoveroptions-source ShowPopoverOptions.source specification>
getSourceUnsafe :: (MonadDOM m, IsShowPopoverOptions self, HasCallStack) => self -> m HTMLElement
getSourceUnsafe self = liftDOM (((((Types.toShowPopoverOptions self) ^. js "source") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://html.spec.whatwg.org/multipage/dom.html#dom-showpopoveroptions-source ShowPopoverOptions.source specification>
getSourceUnchecked :: (MonadDOM m, IsShowPopoverOptions self) => self -> m HTMLElement
getSourceUnchecked self = liftDOM ((((Types.toShowPopoverOptions self) ^. js "source") >>= fromJSValUnchecked))