packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs (webref). Do not edit.
module JSDOM.Generated.SvcOutputMetadata
       (newSvcOutputMetadata, setTemporalLayerId, getTemporalLayerId, getTemporalLayerIdUnsafe, getTemporalLayerIdUnchecked, SvcOutputMetadata(..), gTypeSvcOutputMetadata)
       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/webcodecs/#dictdef-svcoutputmetadata SvcOutputMetadata specification>
newSvcOutputMetadata :: (MonadDOM m) => m SvcOutputMetadata
newSvcOutputMetadata = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-svcoutputmetadata-temporallayerid SvcOutputMetadata.temporalLayerId specification>
setTemporalLayerId :: (MonadDOM m) => SvcOutputMetadata -> Word -> m ()
setTemporalLayerId self val = liftDOM (void (self ^. jss "temporalLayerId" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-svcoutputmetadata-temporallayerid SvcOutputMetadata.temporalLayerId specification>
getTemporalLayerId :: (MonadDOM m) => SvcOutputMetadata -> m (Maybe Word)
getTemporalLayerId self = liftDOM (((self ^. js "temporalLayerId") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-svcoutputmetadata-temporallayerid SvcOutputMetadata.temporalLayerId specification>
getTemporalLayerIdUnsafe :: (MonadDOM m, HasCallStack) => SvcOutputMetadata -> m Word
getTemporalLayerIdUnsafe self = liftDOM ((((self ^. js "temporalLayerId") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-svcoutputmetadata-temporallayerid SvcOutputMetadata.temporalLayerId specification>
getTemporalLayerIdUnchecked :: (MonadDOM m) => SvcOutputMetadata -> m Word
getTemporalLayerIdUnchecked self = liftDOM ((P.round <$> ((self ^. js "temporalLayerId") >>= valToNumber)))