jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUColorDict.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.GPUColorDict
(newGPUColorDict, setR, getR, setG, getG, setB, getB, setA, getA, GPUColorDict(..), gTypeGPUColorDict)
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-gpucolordict GPUColorDict specification>
newGPUColorDict :: (MonadDOM m) => Double -> Double -> Double -> Double -> m GPUColorDict
newGPUColorDict r g b a = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "r" (toJSVal r)) P.>> (o ^. jss "g" (toJSVal g)) P.>> (o ^. jss "b" (toJSVal b)) P.>> (o ^. jss "a" (toJSVal a)) P.>> P.return o)) >>= fromJSValUnchecked))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-r GPUColorDict.r specification>
setR :: (MonadDOM m) => GPUColorDict -> Double -> m ()
setR self val = liftDOM (void (self ^. jss "r" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-r GPUColorDict.r specification>
getR :: (MonadDOM m) => GPUColorDict -> m Double
getR self = liftDOM (((self ^. js "r") >>= valToNumber))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-g GPUColorDict.g specification>
setG :: (MonadDOM m) => GPUColorDict -> Double -> m ()
setG self val = liftDOM (void (self ^. jss "g" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-g GPUColorDict.g specification>
getG :: (MonadDOM m) => GPUColorDict -> m Double
getG self = liftDOM (((self ^. js "g") >>= valToNumber))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-b GPUColorDict.b specification>
setB :: (MonadDOM m) => GPUColorDict -> Double -> m ()
setB self val = liftDOM (void (self ^. jss "b" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-b GPUColorDict.b specification>
getB :: (MonadDOM m) => GPUColorDict -> m Double
getB self = liftDOM (((self ^. js "b") >>= valToNumber))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-a GPUColorDict.a specification>
setA :: (MonadDOM m) => GPUColorDict -> Double -> m ()
setA self val = liftDOM (void (self ^. jss "a" (toJSVal val)))
-- | <https://gpuweb.github.io/gpuweb/#dom-gpucolordict-a GPUColorDict.a specification>
getA :: (MonadDOM m) => GPUColorDict -> m Double
getA self = liftDOM (((self ^. js "a") >>= valToNumber))