jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUOrigin3DDict.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.GPUOrigin3DDict
(newGPUOrigin3DDict, setX, getX, getXUnsafe, getXUnchecked, setY, getY, getYUnsafe, getYUnchecked, setZ, getZ, getZUnsafe, getZUnchecked, GPUOrigin3DDict(..), gTypeGPUOrigin3DDict)
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-gpuorigin3ddict GPUOrigin3DDict specification>
newGPUOrigin3DDict :: (MonadDOM m) => m GPUOrigin3DDict
newGPUOrigin3DDict = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-x GPUOrigin3DDict.x specification>
setX :: (MonadDOM m) => GPUOrigin3DDict -> Word -> m ()
setX self val = liftDOM (void (self ^. jss "x" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-x GPUOrigin3DDict.x specification>
getX :: (MonadDOM m) => GPUOrigin3DDict -> m (Maybe Word)
getX self = liftDOM (((self ^. js "x") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-x GPUOrigin3DDict.x specification>
getXUnsafe :: (MonadDOM m, HasCallStack) => GPUOrigin3DDict -> m Word
getXUnsafe self = liftDOM ((((self ^. js "x") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-x GPUOrigin3DDict.x specification>
getXUnchecked :: (MonadDOM m) => GPUOrigin3DDict -> m Word
getXUnchecked self = liftDOM ((P.round <$> ((self ^. js "x") >>= valToNumber)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-y GPUOrigin3DDict.y specification>
setY :: (MonadDOM m) => GPUOrigin3DDict -> Word -> m ()
setY self val = liftDOM (void (self ^. jss "y" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-y GPUOrigin3DDict.y specification>
getY :: (MonadDOM m) => GPUOrigin3DDict -> m (Maybe Word)
getY self = liftDOM (((self ^. js "y") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-y GPUOrigin3DDict.y specification>
getYUnsafe :: (MonadDOM m, HasCallStack) => GPUOrigin3DDict -> m Word
getYUnsafe self = liftDOM ((((self ^. js "y") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-y GPUOrigin3DDict.y specification>
getYUnchecked :: (MonadDOM m) => GPUOrigin3DDict -> m Word
getYUnchecked self = liftDOM ((P.round <$> ((self ^. js "y") >>= valToNumber)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-z GPUOrigin3DDict.z specification>
setZ :: (MonadDOM m) => GPUOrigin3DDict -> Word -> m ()
setZ self val = liftDOM (void (self ^. jss "z" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-z GPUOrigin3DDict.z specification>
getZ :: (MonadDOM m) => GPUOrigin3DDict -> m (Maybe Word)
getZ self = liftDOM (((self ^. js "z") >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-z GPUOrigin3DDict.z specification>
getZUnsafe :: (MonadDOM m, HasCallStack) => GPUOrigin3DDict -> m Word
getZUnsafe self = liftDOM ((((self ^. js "z") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpuorigin3ddict-z GPUOrigin3DDict.z specification>
getZUnchecked :: (MonadDOM m) => GPUOrigin3DDict -> m Word
getZUnchecked self = liftDOM ((P.round <$> ((self ^. js "z") >>= valToNumber)))