packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PlaneLayout.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs (webref). Do not edit.
module JSDOM.Generated.PlaneLayout
       (newPlaneLayout, setOffset, getOffset, setStride, getStride, PlaneLayout(..), gTypePlaneLayout)
       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://w3c.github.io/webcodecs/#dictdef-planelayout PlaneLayout specification>
newPlaneLayout :: (MonadDOM m) => Word -> Word -> m PlaneLayout
newPlaneLayout offset stride = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "offset" (toJSVal offset)) P.>> (o ^. jss "stride" (toJSVal stride)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-planelayout-offset PlaneLayout.offset specification>
setOffset :: (MonadDOM m) => PlaneLayout -> Word -> m ()
setOffset self val = liftDOM (void (self ^. jss "offset" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-planelayout-offset PlaneLayout.offset specification>
getOffset :: (MonadDOM m) => PlaneLayout -> m Word
getOffset self = liftDOM ((P.round <$> ((self ^. js "offset") >>= valToNumber)))

-- | <https://w3c.github.io/webcodecs/#dom-planelayout-stride PlaneLayout.stride specification>
setStride :: (MonadDOM m) => PlaneLayout -> Word -> m ()
setStride self val = liftDOM (void (self ^. jss "stride" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-planelayout-stride PlaneLayout.stride specification>
getStride :: (MonadDOM m) => PlaneLayout -> m Word
getStride self = liftDOM ((P.round <$> ((self ^. js "stride") >>= valToNumber)))