packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from dom (webref). Do not edit.
module JSDOM.Generated.ElementCreationOptions
       (newElementCreationOptions, setCustomElementRegistry, getCustomElementRegistry, getCustomElementRegistryUnsafe, getCustomElementRegistryUnchecked, setIs, getIs, getIsUnsafe, getIsUnchecked, ElementCreationOptions(..), gTypeElementCreationOptions)
       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://dom.spec.whatwg.org/#dictdef-elementcreationoptions ElementCreationOptions specification>
newElementCreationOptions :: (MonadDOM m) => m ElementCreationOptions
newElementCreationOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-customelementregistry ElementCreationOptions.customElementRegistry specification>
setCustomElementRegistry :: (MonadDOM m) => ElementCreationOptions -> Maybe CustomElementRegistry -> m ()
setCustomElementRegistry self val = liftDOM (void (self ^. jss "customElementRegistry" (toJSVal val)))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-customelementregistry ElementCreationOptions.customElementRegistry specification>
getCustomElementRegistry :: (MonadDOM m) => ElementCreationOptions -> m (Maybe CustomElementRegistry)
getCustomElementRegistry self = liftDOM (((self ^. js "customElementRegistry") >>= fromJSValUnchecked))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-customelementregistry ElementCreationOptions.customElementRegistry specification>
getCustomElementRegistryUnsafe :: (MonadDOM m, HasCallStack) => ElementCreationOptions -> m CustomElementRegistry
getCustomElementRegistryUnsafe self = liftDOM ((((self ^. js "customElementRegistry") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-customelementregistry ElementCreationOptions.customElementRegistry specification>
getCustomElementRegistryUnchecked :: (MonadDOM m) => ElementCreationOptions -> m CustomElementRegistry
getCustomElementRegistryUnchecked self = liftDOM (((self ^. js "customElementRegistry") >>= fromJSValUnchecked))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-is ElementCreationOptions.is specification>
setIs :: (MonadDOM m, ToJSString val) => ElementCreationOptions -> val -> m ()
setIs self val = liftDOM (void (self ^. jss "is" (toJSVal val)))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-is ElementCreationOptions.is specification>
getIs :: (MonadDOM m, FromJSString result) => ElementCreationOptions -> m (Maybe result)
getIs self = liftDOM (((self ^. js "is") >>= fromMaybeJSString))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-is ElementCreationOptions.is specification>
getIsUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => ElementCreationOptions -> m result
getIsUnsafe self = liftDOM ((((self ^. js "is") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://dom.spec.whatwg.org/#dom-elementcreationoptions-is ElementCreationOptions.is specification>
getIsUnchecked :: (MonadDOM m, FromJSString result) => ElementCreationOptions -> m result
getIsUnchecked self = liftDOM (((self ^. js "is") >>= fromJSValUnchecked))