packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/GPUBufferDescriptor.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webgpu (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.GPUBufferDescriptor
       (js_newGPUBufferDescriptor, js_setSize, js_getSize, js_setUsage, js_getUsage, js_setMappedAtCreation, js_getMappedAtCreation, newGPUBufferDescriptor, setSize, getSize, setUsage, getUsage, setMappedAtCreation, getMappedAtCreation, getMappedAtCreationUnsafe, getMappedAtCreationUnchecked, GPUBufferDescriptor(..), gTypeGPUBufferDescriptor)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript safe "(($1, $2) => { return ({\"size\": $1, \"usage\": $2}); })"
        js_newGPUBufferDescriptor :: JSVal -> Word -> IO GPUBufferDescriptor
-- | <https://gpuweb.github.io/gpuweb/#gpubufferdescriptor GPUBufferDescriptor specification>
newGPUBufferDescriptor :: (MonadDOM m) => Word53 -> Word -> m GPUBufferDescriptor
newGPUBufferDescriptor size usage = liftDOM (((toJSVal size) >>= \a1' -> js_newGPUBufferDescriptor a1' (usage)))

foreign import javascript safe "(($1, $2) => { $1[\"size\"] = $2; })"
        js_setSize :: GPUBufferDescriptor -> JSVal -> IO ()
-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-size GPUBufferDescriptor.size specification>
setSize :: (MonadDOM m) => GPUBufferDescriptor -> Word53 -> m ()
setSize self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setSize (self) a2')))

foreign import javascript unsafe "(($1) => { return $1[\"size\"]; })"
        js_getSize :: GPUBufferDescriptor -> IO JSVal
-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-size GPUBufferDescriptor.size specification>
getSize :: (MonadDOM m) => GPUBufferDescriptor -> m Word53
getSize self = liftDOM (((js_getSize (self)) >>= fromJSValUnchecked))

foreign import javascript safe "(($1, $2) => { $1[\"usage\"] = $2; })"
        js_setUsage :: GPUBufferDescriptor -> Word -> IO ()
-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-usage GPUBufferDescriptor.usage specification>
setUsage :: (MonadDOM m) => GPUBufferDescriptor -> Word -> m ()
setUsage self val = liftDOM (void ((js_setUsage (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"usage\"]; })"
        js_getUsage :: GPUBufferDescriptor -> IO Word
-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-usage GPUBufferDescriptor.usage specification>
getUsage :: (MonadDOM m) => GPUBufferDescriptor -> m Word
getUsage self = liftDOM ((js_getUsage (self)))

foreign import javascript safe "(($1, $2) => { $1[\"mappedAtCreation\"] = $2; })"
        js_setMappedAtCreation :: GPUBufferDescriptor -> Bool -> IO ()
-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-mappedatcreation GPUBufferDescriptor.mappedAtCreation specification>
setMappedAtCreation :: (MonadDOM m) => GPUBufferDescriptor -> Bool -> m ()
setMappedAtCreation self val = liftDOM (void ((js_setMappedAtCreation (self) (val))))

foreign import javascript unsafe "(($1) => { return $1[\"mappedAtCreation\"]; })"
        js_getMappedAtCreation :: GPUBufferDescriptor -> IO JSVal
-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-mappedatcreation GPUBufferDescriptor.mappedAtCreation specification>
getMappedAtCreation :: (MonadDOM m) => GPUBufferDescriptor -> m (Maybe Bool)
getMappedAtCreation self = liftDOM (((js_getMappedAtCreation (self)) >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-mappedatcreation GPUBufferDescriptor.mappedAtCreation specification>
getMappedAtCreationUnsafe :: (MonadDOM m, HasCallStack) => GPUBufferDescriptor -> m Bool
getMappedAtCreationUnsafe self = liftDOM ((((js_getMappedAtCreation (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpubufferdescriptor-mappedatcreation GPUBufferDescriptor.mappedAtCreation specification>
getMappedAtCreationUnchecked :: (MonadDOM m) => GPUBufferDescriptor -> m Bool
getMappedAtCreationUnchecked self = liftDOM ((pFromJSVal <$> (js_getMappedAtCreation (self))))