packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webgpu (webref). Do not edit.
module JSDOM.Generated.GPUQuerySetDescriptor
       (newGPUQuerySetDescriptor, setType, getType, setCount, getCount, GPUQuerySetDescriptor(..), gTypeGPUQuerySetDescriptor)
       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://gpuweb.github.io/gpuweb/#dictdef-gpuquerysetdescriptor GPUQuerySetDescriptor specification>
newGPUQuerySetDescriptor :: (MonadDOM m) => GPUQueryType -> Word -> m GPUQuerySetDescriptor
newGPUQuerySetDescriptor type' count = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "type" (toJSVal type')) P.>> (o ^. jss "count" (toJSVal count)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuquerysetdescriptor-type GPUQuerySetDescriptor.type specification>
setType :: (MonadDOM m) => GPUQuerySetDescriptor -> GPUQueryType -> m ()
setType self val = liftDOM (void (self ^. jss "type" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuquerysetdescriptor-type GPUQuerySetDescriptor.type specification>
getType :: (MonadDOM m) => GPUQuerySetDescriptor -> m GPUQueryType
getType self = liftDOM (((self ^. js "type") >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuquerysetdescriptor-count GPUQuerySetDescriptor.count specification>
setCount :: (MonadDOM m) => GPUQuerySetDescriptor -> Word -> m ()
setCount self val = liftDOM (void (self ^. jss "count" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuquerysetdescriptor-count GPUQuerySetDescriptor.count specification>
getCount :: (MonadDOM m) => GPUQuerySetDescriptor -> m Word
getCount self = liftDOM ((P.round <$> ((self ^. js "count") >>= valToNumber)))