packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUVertexBufferLayout.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.GPUVertexBufferLayout
       (newGPUVertexBufferLayout, setArrayStride, getArrayStride, setStepMode, getStepMode, getStepModeUnsafe, getStepModeUnchecked, setAttributes, getAttributes, GPUVertexBufferLayout(..), gTypeGPUVertexBufferLayout)
       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-gpuvertexbufferlayout GPUVertexBufferLayout specification>
newGPUVertexBufferLayout :: (MonadDOM m) => Word53 -> [GPUVertexAttribute] -> m GPUVertexBufferLayout
newGPUVertexBufferLayout arrayStride attributes = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "arrayStride" (toJSVal arrayStride)) P.>> (o ^. jss "attributes" (toJSVal attributes)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-arraystride GPUVertexBufferLayout.arrayStride specification>
setArrayStride :: (MonadDOM m) => GPUVertexBufferLayout -> Word53 -> m ()
setArrayStride self val = liftDOM (void (self ^. jss "arrayStride" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-arraystride GPUVertexBufferLayout.arrayStride specification>
getArrayStride :: (MonadDOM m) => GPUVertexBufferLayout -> m Word53
getArrayStride self = liftDOM (((self ^. js "arrayStride") >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-stepmode GPUVertexBufferLayout.stepMode specification>
setStepMode :: (MonadDOM m) => GPUVertexBufferLayout -> GPUVertexStepMode -> m ()
setStepMode self val = liftDOM (void (self ^. jss "stepMode" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-stepmode GPUVertexBufferLayout.stepMode specification>
getStepMode :: (MonadDOM m) => GPUVertexBufferLayout -> m (Maybe GPUVertexStepMode)
getStepMode self = liftDOM (((self ^. js "stepMode") >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-stepmode GPUVertexBufferLayout.stepMode specification>
getStepModeUnsafe :: (MonadDOM m, HasCallStack) => GPUVertexBufferLayout -> m GPUVertexStepMode
getStepModeUnsafe self = liftDOM ((((self ^. js "stepMode") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-stepmode GPUVertexBufferLayout.stepMode specification>
getStepModeUnchecked :: (MonadDOM m) => GPUVertexBufferLayout -> m GPUVertexStepMode
getStepModeUnchecked self = liftDOM (((self ^. js "stepMode") >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-attributes GPUVertexBufferLayout.attributes specification>
setAttributes :: (MonadDOM m) => GPUVertexBufferLayout -> [GPUVertexAttribute] -> m ()
setAttributes self val = liftDOM (void (self ^. jss "attributes" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpuvertexbufferlayout-attributes GPUVertexBufferLayout.attributes specification>
getAttributes :: (MonadDOM m) => GPUVertexBufferLayout -> m [GPUVertexAttribute]
getAttributes self = liftDOM (((self ^. js "attributes") >>= fromJSValUnchecked))