packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUBindGroupEntry.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.GPUBindGroupEntry
       (newGPUBindGroupEntry, setBinding, getBinding, setResource, getResource, GPUBindGroupEntry(..), gTypeGPUBindGroupEntry)
       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-gpubindgroupentry GPUBindGroupEntry specification>
newGPUBindGroupEntry :: (MonadDOM m, IsGPUBindingResource resource) => Word -> resource -> m GPUBindGroupEntry
newGPUBindGroupEntry binding resource = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "binding" (toJSVal binding)) P.>> (o ^. jss "resource" (toJSVal resource)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpubindgroupentry-binding GPUBindGroupEntry.binding specification>
setBinding :: (MonadDOM m) => GPUBindGroupEntry -> Word -> m ()
setBinding self val = liftDOM (void (self ^. jss "binding" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpubindgroupentry-binding GPUBindGroupEntry.binding specification>
getBinding :: (MonadDOM m) => GPUBindGroupEntry -> m Word
getBinding self = liftDOM ((P.round <$> ((self ^. js "binding") >>= valToNumber)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpubindgroupentry-resource GPUBindGroupEntry.resource specification>
setResource :: (MonadDOM m, IsGPUBindingResource val) => GPUBindGroupEntry -> val -> m ()
setResource self val = liftDOM (void (self ^. jss "resource" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpubindgroupentry-resource GPUBindGroupEntry.resource specification>
getResource :: (MonadDOM m) => GPUBindGroupEntry -> m GPUBindingResource
getResource self = liftDOM (((self ^. js "resource") >>= fromJSValUnchecked))