{-# LANGUAGE PatternSynonyms #-}
-- For HasCallStack compatibility
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.RTCTrackEvent
       (newRTCTrackEvent, getReceiver, getTrack, getStreams,
        getTransceiver, RTCTrackEvent(..), gTypeRTCTrackEvent)
       where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums

-- | <https://developer.mozilla.org/en-US/docs/Web/API/RTCTrackEvent Mozilla RTCTrackEvent documentation> 
newRTCTrackEvent ::
                 (MonadDOM m, ToJSString type') =>
                   type' -> RTCTrackEventInit -> m RTCTrackEvent
newRTCTrackEvent :: forall (m :: * -> *) type'.
(MonadDOM m, ToJSString type') =>
type' -> RTCTrackEventInit -> m RTCTrackEvent
newRTCTrackEvent type'
type' RTCTrackEventInit
eventInitDict
  = DOM RTCTrackEvent -> m RTCTrackEvent
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
      (JSVal -> RTCTrackEvent
RTCTrackEvent (JSVal -> RTCTrackEvent) -> JSM JSVal -> DOM RTCTrackEvent
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
         JSM JSVal -> [JSM JSVal] -> JSM JSVal
forall constructor args.
(MakeObject constructor, MakeArgs args) =>
constructor -> args -> JSM JSVal
new (String -> JSM JSVal
forall a. ToJSString a => a -> JSM JSVal
jsg String
"RTCTrackEvent") [type' -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal type'
type', RTCTrackEventInit -> JSM JSVal
forall a. ToJSVal a => a -> JSM JSVal
toJSVal RTCTrackEventInit
eventInitDict])

-- | <https://developer.mozilla.org/en-US/docs/Web/API/RTCTrackEvent.receiver Mozilla RTCTrackEvent.receiver documentation> 
getReceiver :: (MonadDOM m) => RTCTrackEvent -> m RTCRtpReceiver
getReceiver :: forall (m :: * -> *).
MonadDOM m =>
RTCTrackEvent -> m RTCRtpReceiver
getReceiver RTCTrackEvent
self
  = DOM RTCRtpReceiver -> m RTCRtpReceiver
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((RTCTrackEvent
self RTCTrackEvent
-> Getting (JSM JSVal) RTCTrackEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter RTCTrackEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"receiver") JSM JSVal -> (JSVal -> DOM RTCRtpReceiver) -> DOM RTCRtpReceiver
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM RTCRtpReceiver
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/RTCTrackEvent.track Mozilla RTCTrackEvent.track documentation> 
getTrack :: (MonadDOM m) => RTCTrackEvent -> m MediaStreamTrack
getTrack :: forall (m :: * -> *).
MonadDOM m =>
RTCTrackEvent -> m MediaStreamTrack
getTrack RTCTrackEvent
self
  = DOM MediaStreamTrack -> m MediaStreamTrack
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((RTCTrackEvent
self RTCTrackEvent
-> Getting (JSM JSVal) RTCTrackEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter RTCTrackEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"track") JSM JSVal
-> (JSVal -> DOM MediaStreamTrack) -> DOM MediaStreamTrack
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM MediaStreamTrack
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/RTCTrackEvent.streams Mozilla RTCTrackEvent.streams documentation> 
getStreams :: (MonadDOM m) => RTCTrackEvent -> m [MediaStream]
getStreams :: forall (m :: * -> *).
MonadDOM m =>
RTCTrackEvent -> m [MediaStream]
getStreams RTCTrackEvent
self
  = DOM [MediaStream] -> m [MediaStream]
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((RTCTrackEvent
self RTCTrackEvent
-> Getting (JSM JSVal) RTCTrackEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter RTCTrackEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"streams") JSM JSVal -> (JSVal -> DOM [MediaStream]) -> DOM [MediaStream]
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM [MediaStream]
forall o. FromJSVal o => JSVal -> JSM [o]
fromJSArrayUnchecked)

-- | <https://developer.mozilla.org/en-US/docs/Web/API/RTCTrackEvent.transceiver Mozilla RTCTrackEvent.transceiver documentation> 
getTransceiver ::
               (MonadDOM m) => RTCTrackEvent -> m RTCRtpTransceiver
getTransceiver :: forall (m :: * -> *).
MonadDOM m =>
RTCTrackEvent -> m RTCRtpTransceiver
getTransceiver RTCTrackEvent
self
  = DOM RTCRtpTransceiver -> m RTCRtpTransceiver
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM ((RTCTrackEvent
self RTCTrackEvent
-> Getting (JSM JSVal) RTCTrackEvent (JSM JSVal) -> JSM JSVal
forall s a. s -> Getting a s a -> a
^. String -> IndexPreservingGetter RTCTrackEvent (JSM JSVal)
forall s name.
(MakeObject s, ToJSString name) =>
name -> IndexPreservingGetter s (JSM JSVal)
js String
"transceiver") JSM JSVal
-> (JSVal -> DOM RTCRtpTransceiver) -> DOM RTCRtpTransceiver
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= JSVal -> DOM RTCRtpTransceiver
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked)