jsaddle-dom-0.10.0.0: src/JSDOM/Generated/EncodedVideoChunkInit.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.EncodedVideoChunkInit
(newEncodedVideoChunkInit, setType, getType, setTimestamp, getTimestamp, setDuration, getDuration, getDurationUnsafe, getDurationUnchecked, setData, getData, setTransfer, getTransfer, getTransferUnsafe, getTransferUnchecked, EncodedVideoChunkInit(..), gTypeEncodedVideoChunkInit)
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-encodedvideochunkinit EncodedVideoChunkInit specification>
newEncodedVideoChunkInit :: (MonadDOM m, IsAllowSharedBufferSource data') => EncodedVideoChunkType -> Int53 -> data' -> m EncodedVideoChunkInit
newEncodedVideoChunkInit type' timestamp data' = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "type" (toJSVal type')) P.>> (o ^. jss "timestamp" (toJSVal timestamp)) P.>> (o ^. jss "data" (toJSVal data')) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-type EncodedVideoChunkInit.type specification>
setType :: (MonadDOM m) => EncodedVideoChunkInit -> EncodedVideoChunkType -> m ()
setType self val = liftDOM (void (self ^. jss "type" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-type EncodedVideoChunkInit.type specification>
getType :: (MonadDOM m) => EncodedVideoChunkInit -> m EncodedVideoChunkType
getType self = liftDOM (((self ^. js "type") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-timestamp EncodedVideoChunkInit.timestamp specification>
setTimestamp :: (MonadDOM m) => EncodedVideoChunkInit -> Int53 -> m ()
setTimestamp self val = liftDOM (void (self ^. jss "timestamp" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-timestamp EncodedVideoChunkInit.timestamp specification>
getTimestamp :: (MonadDOM m) => EncodedVideoChunkInit -> m Int53
getTimestamp self = liftDOM (((self ^. js "timestamp") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-duration EncodedVideoChunkInit.duration specification>
setDuration :: (MonadDOM m) => EncodedVideoChunkInit -> Word53 -> m ()
setDuration self val = liftDOM (void (self ^. jss "duration" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-duration EncodedVideoChunkInit.duration specification>
getDuration :: (MonadDOM m) => EncodedVideoChunkInit -> m (Maybe Word53)
getDuration self = liftDOM (((self ^. js "duration") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-duration EncodedVideoChunkInit.duration specification>
getDurationUnsafe :: (MonadDOM m, HasCallStack) => EncodedVideoChunkInit -> m Word53
getDurationUnsafe self = liftDOM ((((self ^. js "duration") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-duration EncodedVideoChunkInit.duration specification>
getDurationUnchecked :: (MonadDOM m) => EncodedVideoChunkInit -> m Word53
getDurationUnchecked self = liftDOM (((self ^. js "duration") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-data EncodedVideoChunkInit.data specification>
setData :: (MonadDOM m, IsAllowSharedBufferSource val) => EncodedVideoChunkInit -> val -> m ()
setData self val = liftDOM (void (self ^. jss "data" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-data EncodedVideoChunkInit.data specification>
getData :: (MonadDOM m) => EncodedVideoChunkInit -> m AllowSharedBufferSource
getData self = liftDOM (((self ^. js "data") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-transfer EncodedVideoChunkInit.transfer specification>
setTransfer :: (MonadDOM m, IsArrayBuffer val) => EncodedVideoChunkInit -> [val] -> m ()
setTransfer self val = liftDOM (void (self ^. jss "transfer" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-transfer EncodedVideoChunkInit.transfer specification>
getTransfer :: (MonadDOM m) => EncodedVideoChunkInit -> m (Maybe [ArrayBuffer])
getTransfer self = liftDOM (((self ^. js "transfer") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-transfer EncodedVideoChunkInit.transfer specification>
getTransferUnsafe :: (MonadDOM m, HasCallStack) => EncodedVideoChunkInit -> m [ArrayBuffer]
getTransferUnsafe self = liftDOM ((((self ^. js "transfer") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webcodecs/#dom-encodedvideochunkinit-transfer EncodedVideoChunkInit.transfer specification>
getTransferUnchecked :: (MonadDOM m) => EncodedVideoChunkInit -> m [ArrayBuffer]
getTransferUnchecked self = liftDOM (((self ^. js "transfer") >>= fromJSValUnchecked))