packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webrtc (webref). Do not edit.
module JSDOM.Generated.RTCDataChannelInit
       (newRTCDataChannelInit, setOrdered, getOrdered, getOrderedUnsafe, getOrderedUnchecked, setMaxPacketLifeTime, getMaxPacketLifeTime, getMaxPacketLifeTimeUnsafe, getMaxPacketLifeTimeUnchecked, setMaxRetransmits, getMaxRetransmits, getMaxRetransmitsUnsafe, getMaxRetransmitsUnchecked, setProtocol, getProtocol, getProtocolUnsafe, getProtocolUnchecked, setNegotiated, getNegotiated, getNegotiatedUnsafe, getNegotiatedUnchecked, setId, getId, getIdUnsafe, getIdUnchecked, setPriority, getPriority, getPriorityUnsafe, getPriorityUnchecked, RTCDataChannelInit(..), gTypeRTCDataChannelInit)
       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/webrtc-pc/#dom-rtcdatachannelinit RTCDataChannelInit specification>
newRTCDataChannelInit :: (MonadDOM m) => m RTCDataChannelInit
newRTCDataChannelInit = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-ordered RTCDataChannelInit.ordered specification>
setOrdered :: (MonadDOM m) => RTCDataChannelInit -> Bool -> m ()
setOrdered self val = liftDOM (void (self ^. jss "ordered" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-ordered RTCDataChannelInit.ordered specification>
getOrdered :: (MonadDOM m) => RTCDataChannelInit -> m (Maybe Bool)
getOrdered self = liftDOM (((self ^. js "ordered") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-ordered RTCDataChannelInit.ordered specification>
getOrderedUnsafe :: (MonadDOM m, HasCallStack) => RTCDataChannelInit -> m Bool
getOrderedUnsafe self = liftDOM ((((self ^. js "ordered") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-ordered RTCDataChannelInit.ordered specification>
getOrderedUnchecked :: (MonadDOM m) => RTCDataChannelInit -> m Bool
getOrderedUnchecked self = liftDOM (((self ^. js "ordered") >>= valToBool))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxpacketlifetime RTCDataChannelInit.maxPacketLifeTime specification>
setMaxPacketLifeTime :: (MonadDOM m) => RTCDataChannelInit -> Word -> m ()
setMaxPacketLifeTime self val = liftDOM (void (self ^. jss "maxPacketLifeTime" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxpacketlifetime RTCDataChannelInit.maxPacketLifeTime specification>
getMaxPacketLifeTime :: (MonadDOM m) => RTCDataChannelInit -> m (Maybe Word)
getMaxPacketLifeTime self = liftDOM (((self ^. js "maxPacketLifeTime") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxpacketlifetime RTCDataChannelInit.maxPacketLifeTime specification>
getMaxPacketLifeTimeUnsafe :: (MonadDOM m, HasCallStack) => RTCDataChannelInit -> m Word
getMaxPacketLifeTimeUnsafe self = liftDOM ((((self ^. js "maxPacketLifeTime") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxpacketlifetime RTCDataChannelInit.maxPacketLifeTime specification>
getMaxPacketLifeTimeUnchecked :: (MonadDOM m) => RTCDataChannelInit -> m Word
getMaxPacketLifeTimeUnchecked self = liftDOM ((P.round <$> ((self ^. js "maxPacketLifeTime") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxretransmits RTCDataChannelInit.maxRetransmits specification>
setMaxRetransmits :: (MonadDOM m) => RTCDataChannelInit -> Word -> m ()
setMaxRetransmits self val = liftDOM (void (self ^. jss "maxRetransmits" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxretransmits RTCDataChannelInit.maxRetransmits specification>
getMaxRetransmits :: (MonadDOM m) => RTCDataChannelInit -> m (Maybe Word)
getMaxRetransmits self = liftDOM (((self ^. js "maxRetransmits") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxretransmits RTCDataChannelInit.maxRetransmits specification>
getMaxRetransmitsUnsafe :: (MonadDOM m, HasCallStack) => RTCDataChannelInit -> m Word
getMaxRetransmitsUnsafe self = liftDOM ((((self ^. js "maxRetransmits") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-maxretransmits RTCDataChannelInit.maxRetransmits specification>
getMaxRetransmitsUnchecked :: (MonadDOM m) => RTCDataChannelInit -> m Word
getMaxRetransmitsUnchecked self = liftDOM ((P.round <$> ((self ^. js "maxRetransmits") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-protocol RTCDataChannelInit.protocol specification>
setProtocol :: (MonadDOM m, ToJSString val) => RTCDataChannelInit -> val -> m ()
setProtocol self val = liftDOM (void (self ^. jss "protocol" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-protocol RTCDataChannelInit.protocol specification>
getProtocol :: (MonadDOM m, FromJSString result) => RTCDataChannelInit -> m (Maybe result)
getProtocol self = liftDOM (((self ^. js "protocol") >>= fromMaybeJSString))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-protocol RTCDataChannelInit.protocol specification>
getProtocolUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => RTCDataChannelInit -> m result
getProtocolUnsafe self = liftDOM ((((self ^. js "protocol") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-protocol RTCDataChannelInit.protocol specification>
getProtocolUnchecked :: (MonadDOM m, FromJSString result) => RTCDataChannelInit -> m result
getProtocolUnchecked self = liftDOM (((self ^. js "protocol") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-negotiated RTCDataChannelInit.negotiated specification>
setNegotiated :: (MonadDOM m) => RTCDataChannelInit -> Bool -> m ()
setNegotiated self val = liftDOM (void (self ^. jss "negotiated" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-negotiated RTCDataChannelInit.negotiated specification>
getNegotiated :: (MonadDOM m) => RTCDataChannelInit -> m (Maybe Bool)
getNegotiated self = liftDOM (((self ^. js "negotiated") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-negotiated RTCDataChannelInit.negotiated specification>
getNegotiatedUnsafe :: (MonadDOM m, HasCallStack) => RTCDataChannelInit -> m Bool
getNegotiatedUnsafe self = liftDOM ((((self ^. js "negotiated") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-negotiated RTCDataChannelInit.negotiated specification>
getNegotiatedUnchecked :: (MonadDOM m) => RTCDataChannelInit -> m Bool
getNegotiatedUnchecked self = liftDOM (((self ^. js "negotiated") >>= valToBool))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-id RTCDataChannelInit.id specification>
setId :: (MonadDOM m) => RTCDataChannelInit -> Word -> m ()
setId self val = liftDOM (void (self ^. jss "id" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-id RTCDataChannelInit.id specification>
getId :: (MonadDOM m) => RTCDataChannelInit -> m (Maybe Word)
getId self = liftDOM (((self ^. js "id") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-id RTCDataChannelInit.id specification>
getIdUnsafe :: (MonadDOM m, HasCallStack) => RTCDataChannelInit -> m Word
getIdUnsafe self = liftDOM ((((self ^. js "id") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelinit-id RTCDataChannelInit.id specification>
getIdUnchecked :: (MonadDOM m) => RTCDataChannelInit -> m Word
getIdUnchecked self = liftDOM ((P.round <$> ((self ^. js "id") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-priority/#dom-rtcdatachannelinit-priority RTCDataChannelInit.priority specification>
setPriority :: (MonadDOM m) => RTCDataChannelInit -> RTCPriorityType -> m ()
setPriority self val = liftDOM (void (self ^. jss "priority" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-priority/#dom-rtcdatachannelinit-priority RTCDataChannelInit.priority specification>
getPriority :: (MonadDOM m) => RTCDataChannelInit -> m (Maybe RTCPriorityType)
getPriority self = liftDOM (((self ^. js "priority") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-priority/#dom-rtcdatachannelinit-priority RTCDataChannelInit.priority specification>
getPriorityUnsafe :: (MonadDOM m, HasCallStack) => RTCDataChannelInit -> m RTCPriorityType
getPriorityUnsafe self = liftDOM ((((self ^. js "priority") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-priority/#dom-rtcdatachannelinit-priority RTCDataChannelInit.priority specification>
getPriorityUnchecked :: (MonadDOM m) => RTCDataChannelInit -> m RTCPriorityType
getPriorityUnchecked self = liftDOM (((self ^. js "priority") >>= fromJSValUnchecked))