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