ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/CookieListItem.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from cookiestore (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.CookieListItem
(js_newCookieListItem, js_setName, js_getName, js_setValue, js_getValue, 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 GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums
foreign import javascript safe "(() => { return ({}); })"
js_newCookieListItem :: IO CookieListItem
-- | <https://cookiestore.spec.whatwg.org/#dictdef-cookielistitem CookieListItem specification>
newCookieListItem :: (MonadDOM m) => m CookieListItem
newCookieListItem = liftDOM ((js_newCookieListItem))
foreign import javascript safe "(($1, $2) => { $1[\"name\"] = $2; })"
js_setName :: CookieListItem -> JSString -> IO ()
-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-name CookieListItem.name specification>
setName :: (MonadDOM m, ToJSString val) => CookieListItem -> val -> m ()
setName self val = liftDOM (void ((js_setName (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"name\"]; })"
js_getName :: CookieListItem -> IO JSVal
-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-name CookieListItem.name specification>
getName :: (MonadDOM m, FromJSString result) => CookieListItem -> m (Maybe result)
getName self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getName (self))))
-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-name CookieListItem.name specification>
getNameUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => CookieListItem -> m result
getNameUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getName (self))) >>= 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 ((pFromJSVal <$> (js_getName (self))))
foreign import javascript safe "(($1, $2) => { $1[\"value\"] = $2; })"
js_setValue :: CookieListItem -> JSString -> IO ()
-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-value CookieListItem.value specification>
setValue :: (MonadDOM m, ToJSString val) => CookieListItem -> val -> m ()
setValue self val = liftDOM (void ((js_setValue (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"value\"]; })"
js_getValue :: CookieListItem -> IO JSVal
-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-value CookieListItem.value specification>
getValue :: (MonadDOM m, FromJSString result) => CookieListItem -> m (Maybe result)
getValue self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getValue (self))))
-- | <https://cookiestore.spec.whatwg.org/#dom-cookielistitem-value CookieListItem.value specification>
getValueUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => CookieListItem -> m result
getValueUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getValue (self))) >>= 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 ((pFromJSVal <$> (js_getValue (self))))