ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/EventSourceInit.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from html (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.EventSourceInit
(js_newEventSourceInit, js_setWithCredentials, js_getWithCredentials, newEventSourceInit, setWithCredentials, getWithCredentials, getWithCredentialsUnsafe, getWithCredentialsUnchecked, EventSourceInit(..), gTypeEventSourceInit)
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_newEventSourceInit :: IO EventSourceInit
-- | <https://html.spec.whatwg.org/multipage/server-sent-events.html#eventsourceinit EventSourceInit specification>
newEventSourceInit :: (MonadDOM m) => m EventSourceInit
newEventSourceInit = liftDOM ((js_newEventSourceInit))
foreign import javascript safe "(($1, $2) => { $1[\"withCredentials\"] = $2; })"
js_setWithCredentials :: EventSourceInit -> Bool -> IO ()
-- | <https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsourceinit-withcredentials EventSourceInit.withCredentials specification>
setWithCredentials :: (MonadDOM m) => EventSourceInit -> Bool -> m ()
setWithCredentials self val = liftDOM (void ((js_setWithCredentials (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"withCredentials\"]; })"
js_getWithCredentials :: EventSourceInit -> IO JSVal
-- | <https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsourceinit-withcredentials EventSourceInit.withCredentials specification>
getWithCredentials :: (MonadDOM m) => EventSourceInit -> m (Maybe Bool)
getWithCredentials self = liftDOM (((js_getWithCredentials (self)) >>= fromJSValUnchecked))
-- | <https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsourceinit-withcredentials EventSourceInit.withCredentials specification>
getWithCredentialsUnsafe :: (MonadDOM m, HasCallStack) => EventSourceInit -> m Bool
getWithCredentialsUnsafe self = liftDOM ((((js_getWithCredentials (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://html.spec.whatwg.org/multipage/server-sent-events.html#dom-eventsourceinit-withcredentials EventSourceInit.withCredentials specification>
getWithCredentialsUnchecked :: (MonadDOM m) => EventSourceInit -> m Bool
getWithCredentialsUnchecked self = liftDOM ((pFromJSVal <$> (js_getWithCredentials (self))))