jsaddle-dom-0.10.0.0: src/JSDOM/Generated/VideoEncoderSupport.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.VideoEncoderSupport
(newVideoEncoderSupport, setSupported, getSupported, getSupportedUnsafe, getSupportedUnchecked, setConfig, getConfig, getConfigUnsafe, getConfigUnchecked, VideoEncoderSupport(..), gTypeVideoEncoderSupport)
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-videoencodersupport VideoEncoderSupport specification>
newVideoEncoderSupport :: (MonadDOM m) => m VideoEncoderSupport
newVideoEncoderSupport = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-supported VideoEncoderSupport.supported specification>
setSupported :: (MonadDOM m) => VideoEncoderSupport -> Bool -> m ()
setSupported self val = liftDOM (void (self ^. jss "supported" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-supported VideoEncoderSupport.supported specification>
getSupported :: (MonadDOM m) => VideoEncoderSupport -> m (Maybe Bool)
getSupported self = liftDOM (((self ^. js "supported") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-supported VideoEncoderSupport.supported specification>
getSupportedUnsafe :: (MonadDOM m, HasCallStack) => VideoEncoderSupport -> m Bool
getSupportedUnsafe self = liftDOM ((((self ^. js "supported") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-supported VideoEncoderSupport.supported specification>
getSupportedUnchecked :: (MonadDOM m) => VideoEncoderSupport -> m Bool
getSupportedUnchecked self = liftDOM (((self ^. js "supported") >>= valToBool))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-config VideoEncoderSupport.config specification>
setConfig :: (MonadDOM m) => VideoEncoderSupport -> VideoEncoderConfig -> m ()
setConfig self val = liftDOM (void (self ^. jss "config" (toJSVal val)))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-config VideoEncoderSupport.config specification>
getConfig :: (MonadDOM m) => VideoEncoderSupport -> m (Maybe VideoEncoderConfig)
getConfig self = liftDOM (((self ^. js "config") >>= fromJSValUnchecked))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-config VideoEncoderSupport.config specification>
getConfigUnsafe :: (MonadDOM m, HasCallStack) => VideoEncoderSupport -> m VideoEncoderConfig
getConfigUnsafe self = liftDOM ((((self ^. js "config") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/webcodecs/#dom-videoencodersupport-config VideoEncoderSupport.config specification>
getConfigUnchecked :: (MonadDOM m) => VideoEncoderSupport -> m VideoEncoderConfig
getConfigUnchecked self = liftDOM (((self ^. js "config") >>= fromJSValUnchecked))