packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/SanitizerAttributeNamespace.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.SanitizerAttributeNamespace
       (newSanitizerAttributeNamespace, setName, getName, setNamespace, getNamespace, getNamespaceUnsafe, getNamespaceUnchecked, SanitizerAttributeNamespace(..), gTypeSanitizerAttributeNamespace)
       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/dynamic-markup-insertion.html#sanitizerattributenamespace SanitizerAttributeNamespace specification>
newSanitizerAttributeNamespace :: (MonadDOM m, ToJSString name) => name -> m SanitizerAttributeNamespace
newSanitizerAttributeNamespace name = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "name" (toJSVal name)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizerattributenamespace-name SanitizerAttributeNamespace.name specification>
setName :: (MonadDOM m, ToJSString val) => SanitizerAttributeNamespace -> val -> m ()
setName self val = liftDOM (void (self ^. jss "name" (toJSVal val)))

-- | <https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-sanitizerattributenamespace-name SanitizerAttributeNamespace.name specification>
getName :: (MonadDOM m, FromJSString result) => SanitizerAttributeNamespace -> m result
getName self = liftDOM (((self ^. js "name") >>= fromJSValUnchecked))

setNamespace :: (MonadDOM m, ToJSString val) => SanitizerAttributeNamespace -> Maybe val -> m ()
setNamespace self val = liftDOM (void (self ^. jss "namespace" (toJSVal val)))

getNamespace :: (MonadDOM m, FromJSString result) => SanitizerAttributeNamespace -> m (Maybe result)
getNamespace self = liftDOM (((self ^. js "namespace") >>= fromMaybeJSString))

getNamespaceUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => SanitizerAttributeNamespace -> m result
getNamespaceUnsafe self = liftDOM ((((self ^. js "namespace") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

getNamespaceUnchecked :: (MonadDOM m, FromJSString result) => SanitizerAttributeNamespace -> m result
getNamespaceUnchecked self = liftDOM (((self ^. js "namespace") >>= fromJSValUnchecked))