packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/RTCRtpContributingSource.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.RTCRtpContributingSource
       (newRTCRtpContributingSource, setTimestamp, getTimestamp, setSource, getSource, setAudioLevel, getAudioLevel, getAudioLevelUnsafe, getAudioLevelUnchecked, setRtpTimestamp, getRtpTimestamp, RTCRtpContributingSource(..), gTypeRTCRtpContributingSource, IsRTCRtpContributingSource, toRTCRtpContributingSource)
       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-rtcrtpcontributingsource RTCRtpContributingSource specification>
newRTCRtpContributingSource :: (MonadDOM m) => Double -> Word -> Word -> m RTCRtpContributingSource
newRTCRtpContributingSource timestamp source rtpTimestamp = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "timestamp" (toJSVal timestamp)) P.>> (o ^. jss "source" (toJSVal source)) P.>> (o ^. jss "rtpTimestamp" (toJSVal rtpTimestamp)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-timestamp RTCRtpContributingSource.timestamp specification>
setTimestamp :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> Double -> m ()
setTimestamp self val = liftDOM (void ((Types.toRTCRtpContributingSource self) ^. jss "timestamp" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-timestamp RTCRtpContributingSource.timestamp specification>
getTimestamp :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> m Double
getTimestamp self = liftDOM ((((Types.toRTCRtpContributingSource self) ^. js "timestamp") >>= valToNumber))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-source RTCRtpContributingSource.source specification>
setSource :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> Word -> m ()
setSource self val = liftDOM (void ((Types.toRTCRtpContributingSource self) ^. jss "source" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-source RTCRtpContributingSource.source specification>
getSource :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> m Word
getSource self = liftDOM ((P.round <$> (((Types.toRTCRtpContributingSource self) ^. js "source") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-audiolevel RTCRtpContributingSource.audioLevel specification>
setAudioLevel :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> Double -> m ()
setAudioLevel self val = liftDOM (void ((Types.toRTCRtpContributingSource self) ^. jss "audioLevel" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-audiolevel RTCRtpContributingSource.audioLevel specification>
getAudioLevel :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> m (Maybe Double)
getAudioLevel self = liftDOM ((((Types.toRTCRtpContributingSource self) ^. js "audioLevel") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-audiolevel RTCRtpContributingSource.audioLevel specification>
getAudioLevelUnsafe :: (MonadDOM m, IsRTCRtpContributingSource self, HasCallStack) => self -> m Double
getAudioLevelUnsafe self = liftDOM (((((Types.toRTCRtpContributingSource self) ^. js "audioLevel") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-audiolevel RTCRtpContributingSource.audioLevel specification>
getAudioLevelUnchecked :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> m Double
getAudioLevelUnchecked self = liftDOM ((((Types.toRTCRtpContributingSource self) ^. js "audioLevel") >>= valToNumber))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-rtptimestamp RTCRtpContributingSource.rtpTimestamp specification>
setRtpTimestamp :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> Word -> m ()
setRtpTimestamp self val = liftDOM (void ((Types.toRTCRtpContributingSource self) ^. jss "rtpTimestamp" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource-rtptimestamp RTCRtpContributingSource.rtpTimestamp specification>
getRtpTimestamp :: (MonadDOM m, IsRTCRtpContributingSource self) => self -> m Word
getRtpTimestamp self = liftDOM ((P.round <$> (((Types.toRTCRtpContributingSource self) ^. js "rtpTimestamp") >>= valToNumber)))