jsaddle-dom-0.10.0.0: src/JSDOM/Generated/RTCRtpTransceiverInit.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.RTCRtpTransceiverInit
(newRTCRtpTransceiverInit, setDirection, getDirection, getDirectionUnsafe, getDirectionUnchecked, setStreams, getStreams, getStreamsUnsafe, getStreamsUnchecked, setSendEncodings, getSendEncodings, getSendEncodingsUnsafe, getSendEncodingsUnchecked, RTCRtpTransceiverInit(..), gTypeRTCRtpTransceiverInit)
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-rtcrtptransceiverinit RTCRtpTransceiverInit specification>
newRTCRtpTransceiverInit :: (MonadDOM m) => m RTCRtpTransceiverInit
newRTCRtpTransceiverInit = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-direction RTCRtpTransceiverInit.direction specification>
setDirection :: (MonadDOM m) => RTCRtpTransceiverInit -> RTCRtpTransceiverDirection -> m ()
setDirection self val = liftDOM (void (self ^. jss "direction" (toJSVal val)))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-direction RTCRtpTransceiverInit.direction specification>
getDirection :: (MonadDOM m) => RTCRtpTransceiverInit -> m (Maybe RTCRtpTransceiverDirection)
getDirection self = liftDOM (((self ^. js "direction") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-direction RTCRtpTransceiverInit.direction specification>
getDirectionUnsafe :: (MonadDOM m, HasCallStack) => RTCRtpTransceiverInit -> m RTCRtpTransceiverDirection
getDirectionUnsafe self = liftDOM ((((self ^. js "direction") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-direction RTCRtpTransceiverInit.direction specification>
getDirectionUnchecked :: (MonadDOM m) => RTCRtpTransceiverInit -> m RTCRtpTransceiverDirection
getDirectionUnchecked self = liftDOM (((self ^. js "direction") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-streams RTCRtpTransceiverInit.streams specification>
setStreams :: (MonadDOM m) => RTCRtpTransceiverInit -> [MediaStream] -> m ()
setStreams self val = liftDOM (void (self ^. jss "streams" (toJSVal val)))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-streams RTCRtpTransceiverInit.streams specification>
getStreams :: (MonadDOM m) => RTCRtpTransceiverInit -> m (Maybe [MediaStream])
getStreams self = liftDOM (((self ^. js "streams") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-streams RTCRtpTransceiverInit.streams specification>
getStreamsUnsafe :: (MonadDOM m, HasCallStack) => RTCRtpTransceiverInit -> m [MediaStream]
getStreamsUnsafe self = liftDOM ((((self ^. js "streams") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-streams RTCRtpTransceiverInit.streams specification>
getStreamsUnchecked :: (MonadDOM m) => RTCRtpTransceiverInit -> m [MediaStream]
getStreamsUnchecked self = liftDOM (((self ^. js "streams") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-sendencodings RTCRtpTransceiverInit.sendEncodings specification>
setSendEncodings :: (MonadDOM m) => RTCRtpTransceiverInit -> [RTCRtpEncodingParameters] -> m ()
setSendEncodings self val = liftDOM (void (self ^. jss "sendEncodings" (toJSVal val)))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-sendencodings RTCRtpTransceiverInit.sendEncodings specification>
getSendEncodings :: (MonadDOM m) => RTCRtpTransceiverInit -> m (Maybe [RTCRtpEncodingParameters])
getSendEncodings self = liftDOM (((self ^. js "sendEncodings") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-sendencodings RTCRtpTransceiverInit.sendEncodings specification>
getSendEncodingsUnsafe :: (MonadDOM m, HasCallStack) => RTCRtpTransceiverInit -> m [RTCRtpEncodingParameters]
getSendEncodingsUnsafe self = liftDOM ((((self ^. js "sendEncodings") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit-sendencodings RTCRtpTransceiverInit.sendEncodings specification>
getSendEncodingsUnchecked :: (MonadDOM m) => RTCRtpTransceiverInit -> m [RTCRtpEncodingParameters]
getSendEncodingsUnchecked self = liftDOM (((self ^. js "sendEncodings") >>= fromJSValUnchecked))