ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/RTCRtpTransceiver.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webrtc (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.RTCRtpTransceiver
(js_setCodecPreferences, js_stop, js_getMid, js_getSender, js_getReceiver, js_setDirection, js_getDirection, js_getCurrentDirection, setCodecPreferences, stop, getMid, getMidUnsafe, getMidUnchecked, getSender, getReceiver, setDirection, getDirection, getCurrentDirection, getCurrentDirectionUnsafe, getCurrentDirectionUnchecked, RTCRtpTransceiver(..), gTypeRTCRtpTransceiver)
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 "(($1, $2) => { return $1[\"setCodecPreferences\"]($2); })"
js_setCodecPreferences :: RTCRtpTransceiver -> JSVal -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/setCodecPreferences MDN RTCRtpTransceiver.setCodecPreferences documentation>
setCodecPreferences :: (MonadDOM m, IsRTCRtpCodec codecs) => RTCRtpTransceiver -> [codecs] -> m ()
setCodecPreferences self codecs = liftDOM (void (((toJSVal codecs) >>= \a2' -> js_setCodecPreferences (self) a2')))
foreign import javascript safe "(($1) => { return $1[\"stop\"](); })"
js_stop :: RTCRtpTransceiver -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/stop MDN RTCRtpTransceiver.stop documentation>
stop :: (MonadDOM m) => RTCRtpTransceiver -> m ()
stop self = liftDOM (void ((js_stop (self))))
foreign import javascript unsafe "(($1) => { return $1[\"mid\"]; })"
js_getMid :: RTCRtpTransceiver -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/mid MDN RTCRtpTransceiver.mid documentation>
getMid :: (MonadDOM m, FromJSString result) => RTCRtpTransceiver -> m (Maybe result)
getMid self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getMid (self))))
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/mid MDN RTCRtpTransceiver.mid documentation>
getMidUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => RTCRtpTransceiver -> m result
getMidUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getMid (self))) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/mid MDN RTCRtpTransceiver.mid documentation>
getMidUnchecked :: (MonadDOM m, FromJSString result) => RTCRtpTransceiver -> m result
getMidUnchecked self = liftDOM ((pFromJSVal <$> (js_getMid (self))))
foreign import javascript unsafe "(($1) => { return $1[\"sender\"]; })"
js_getSender :: RTCRtpTransceiver -> IO RTCRtpSender
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/sender MDN RTCRtpTransceiver.sender documentation>
getSender :: (MonadDOM m) => RTCRtpTransceiver -> m RTCRtpSender
getSender self = liftDOM ((js_getSender (self)))
foreign import javascript unsafe "(($1) => { return $1[\"receiver\"]; })"
js_getReceiver :: RTCRtpTransceiver -> IO RTCRtpReceiver
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/receiver MDN RTCRtpTransceiver.receiver documentation>
getReceiver :: (MonadDOM m) => RTCRtpTransceiver -> m RTCRtpReceiver
getReceiver self = liftDOM ((js_getReceiver (self)))
foreign import javascript safe "(($1, $2) => { $1[\"direction\"] = $2; })"
js_setDirection :: RTCRtpTransceiver -> JSVal -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/direction MDN RTCRtpTransceiver.direction documentation>
setDirection :: (MonadDOM m) => RTCRtpTransceiver -> RTCRtpTransceiverDirection -> m ()
setDirection self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setDirection (self) a2')))
foreign import javascript unsafe "(($1) => { return $1[\"direction\"]; })"
js_getDirection :: RTCRtpTransceiver -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/direction MDN RTCRtpTransceiver.direction documentation>
getDirection :: (MonadDOM m) => RTCRtpTransceiver -> m RTCRtpTransceiverDirection
getDirection self = liftDOM (((js_getDirection (self)) >>= fromJSValUnchecked))
foreign import javascript unsafe "(($1) => { return $1[\"currentDirection\"]; })"
js_getCurrentDirection :: RTCRtpTransceiver -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/currentDirection MDN RTCRtpTransceiver.currentDirection documentation>
getCurrentDirection :: (MonadDOM m) => RTCRtpTransceiver -> m (Maybe RTCRtpTransceiverDirection)
getCurrentDirection self = liftDOM (((js_getCurrentDirection (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/currentDirection MDN RTCRtpTransceiver.currentDirection documentation>
getCurrentDirectionUnsafe :: (MonadDOM m, HasCallStack) => RTCRtpTransceiver -> m RTCRtpTransceiverDirection
getCurrentDirectionUnsafe self = liftDOM ((((js_getCurrentDirection (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/RTCRtpTransceiver/currentDirection MDN RTCRtpTransceiver.currentDirection documentation>
getCurrentDirectionUnchecked :: (MonadDOM m) => RTCRtpTransceiver -> m RTCRtpTransceiverDirection
getCurrentDirectionUnchecked self = liftDOM ((pFromJSVal <$> (js_getCurrentDirection (self))))