packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webtransport (webref). Do not edit.
module JSDOM.Generated.WebTransportSendStreamOptions
       (newWebTransportSendStreamOptions, setWaitUntilAvailable, getWaitUntilAvailable, getWaitUntilAvailableUnsafe, getWaitUntilAvailableUnchecked, WebTransportSendStreamOptions(..), gTypeWebTransportSendStreamOptions)
       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://w3c.github.io/webtransport/#dictdef-webtransportsendstreamoptions WebTransportSendStreamOptions specification>
newWebTransportSendStreamOptions :: (MonadDOM m) => m WebTransportSendStreamOptions
newWebTransportSendStreamOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webtransport/#dom-webtransportsendstreamoptions-waituntilavailable WebTransportSendStreamOptions.waitUntilAvailable specification>
setWaitUntilAvailable :: (MonadDOM m) => WebTransportSendStreamOptions -> Bool -> m ()
setWaitUntilAvailable self val = liftDOM (void (self ^. jss "waitUntilAvailable" (toJSVal val)))

-- | <https://w3c.github.io/webtransport/#dom-webtransportsendstreamoptions-waituntilavailable WebTransportSendStreamOptions.waitUntilAvailable specification>
getWaitUntilAvailable :: (MonadDOM m) => WebTransportSendStreamOptions -> m (Maybe Bool)
getWaitUntilAvailable self = liftDOM (((self ^. js "waitUntilAvailable") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webtransport/#dom-webtransportsendstreamoptions-waituntilavailable WebTransportSendStreamOptions.waitUntilAvailable specification>
getWaitUntilAvailableUnsafe :: (MonadDOM m, HasCallStack) => WebTransportSendStreamOptions -> m Bool
getWaitUntilAvailableUnsafe self = liftDOM ((((self ^. js "waitUntilAvailable") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webtransport/#dom-webtransportsendstreamoptions-waituntilavailable WebTransportSendStreamOptions.waitUntilAvailable specification>
getWaitUntilAvailableUnchecked :: (MonadDOM m) => WebTransportSendStreamOptions -> m Bool
getWaitUntilAvailableUnchecked self = liftDOM (((self ^. js "waitUntilAvailable") >>= valToBool))