packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/VideoDecoderSupport.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.VideoDecoderSupport
       (newVideoDecoderSupport, setSupported, getSupported, getSupportedUnsafe, getSupportedUnchecked, setConfig, getConfig, getConfigUnsafe, getConfigUnchecked, VideoDecoderSupport(..), gTypeVideoDecoderSupport)
       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-videodecodersupport VideoDecoderSupport specification>
newVideoDecoderSupport :: (MonadDOM m) => m VideoDecoderSupport
newVideoDecoderSupport = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-supported VideoDecoderSupport.supported specification>
setSupported :: (MonadDOM m) => VideoDecoderSupport -> Bool -> m ()
setSupported self val = liftDOM (void (self ^. jss "supported" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-supported VideoDecoderSupport.supported specification>
getSupported :: (MonadDOM m) => VideoDecoderSupport -> m (Maybe Bool)
getSupported self = liftDOM (((self ^. js "supported") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-supported VideoDecoderSupport.supported specification>
getSupportedUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderSupport -> m Bool
getSupportedUnsafe self = liftDOM ((((self ^. js "supported") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-supported VideoDecoderSupport.supported specification>
getSupportedUnchecked :: (MonadDOM m) => VideoDecoderSupport -> m Bool
getSupportedUnchecked self = liftDOM (((self ^. js "supported") >>= valToBool))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-config VideoDecoderSupport.config specification>
setConfig :: (MonadDOM m) => VideoDecoderSupport -> VideoDecoderConfig -> m ()
setConfig self val = liftDOM (void (self ^. jss "config" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-config VideoDecoderSupport.config specification>
getConfig :: (MonadDOM m) => VideoDecoderSupport -> m (Maybe VideoDecoderConfig)
getConfig self = liftDOM (((self ^. js "config") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-config VideoDecoderSupport.config specification>
getConfigUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderSupport -> m VideoDecoderConfig
getConfigUnsafe self = liftDOM ((((self ^. js "config") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecodersupport-config VideoDecoderSupport.config specification>
getConfigUnchecked :: (MonadDOM m) => VideoDecoderSupport -> m VideoDecoderConfig
getConfigUnchecked self = liftDOM (((self ^. js "config") >>= fromJSValUnchecked))