packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from cookiestore (webref). Do not edit.
module JSDOM.Generated.CookieListItem
       (newCookieListItem, setName, getName, getNameUnsafe, getNameUnchecked, setValue, getValue, getValueUnsafe, getValueUnchecked, CookieListItem(..), gTypeCookieListItem)
       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://cookiestore.spec.whatwg.org/#dictdef-cookielistitem CookieListItem specification>
newCookieListItem :: (MonadDOM m) => m CookieListItem
newCookieListItem = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-name CookieListItem.name specification>
setName :: (MonadDOM m, ToJSString val) => CookieListItem -> val -> m ()
setName self val = liftDOM (void (self ^. jss "name" (toJSVal val)))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-name CookieListItem.name specification>
getName :: (MonadDOM m, FromJSString result) => CookieListItem -> m (Maybe result)
getName self = liftDOM (((self ^. js "name") >>= fromMaybeJSString))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-name CookieListItem.name specification>
getNameUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => CookieListItem -> m result
getNameUnsafe self = liftDOM ((((self ^. js "name") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-name CookieListItem.name specification>
getNameUnchecked :: (MonadDOM m, FromJSString result) => CookieListItem -> m result
getNameUnchecked self = liftDOM (((self ^. js "name") >>= fromJSValUnchecked))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-value CookieListItem.value specification>
setValue :: (MonadDOM m, ToJSString val) => CookieListItem -> val -> m ()
setValue self val = liftDOM (void (self ^. jss "value" (toJSVal val)))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-value CookieListItem.value specification>
getValue :: (MonadDOM m, FromJSString result) => CookieListItem -> m (Maybe result)
getValue self = liftDOM (((self ^. js "value") >>= fromMaybeJSString))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-value CookieListItem.value specification>
getValueUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => CookieListItem -> m result
getValueUnsafe self = liftDOM ((((self ^. js "value") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-value CookieListItem.value specification>
getValueUnchecked :: (MonadDOM m, FromJSString result) => CookieListItem -> m result
getValueUnchecked self = liftDOM (((self ^. js "value") >>= fromJSValUnchecked))