{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.DOMRect
(newDOMRect, fromRect, fromRect_, setX, getX, setY, getY, setWidth,
getWidth, setHeight, getHeight, DOMRect(..), gTypeDOMRect)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
newDOMRect ::
(MonadDOM m) =>
Maybe Double ->
Maybe Double -> Maybe Double -> Maybe Double -> m DOMRect
newDOMRect x y width height
= liftDOM
(DOMRect <$>
new (jsg "DOMRect")
[toJSVal x, toJSVal y, toJSVal width, toJSVal height])
fromRect :: (MonadDOM m) => Maybe DOMRectInit -> m DOMRect
fromRect other
= liftDOM
(((jsg "DOMRect") ^. jsf "fromRect" [toJSVal other]) >>=
fromJSValUnchecked)
fromRect_ :: (MonadDOM m) => Maybe DOMRectInit -> m ()
fromRect_ other
= liftDOM
(void ((jsg "DOMRect") ^. jsf "fromRect" [toJSVal other]))
setX :: (MonadDOM m) => DOMRect -> Double -> m ()
setX self val = liftDOM (self ^. jss "x" (toJSVal val))
getX :: (MonadDOM m) => DOMRect -> m Double
getX self = liftDOM ((self ^. js "x") >>= valToNumber)
setY :: (MonadDOM m) => DOMRect -> Double -> m ()
setY self val = liftDOM (self ^. jss "y" (toJSVal val))
getY :: (MonadDOM m) => DOMRect -> m Double
getY self = liftDOM ((self ^. js "y") >>= valToNumber)
setWidth :: (MonadDOM m) => DOMRect -> Double -> m ()
setWidth self val = liftDOM (self ^. jss "width" (toJSVal val))
getWidth :: (MonadDOM m) => DOMRect -> m Double
getWidth self = liftDOM ((self ^. js "width") >>= valToNumber)
setHeight :: (MonadDOM m) => DOMRect -> Double -> m ()
setHeight self val = liftDOM (self ^. jss "height" (toJSVal val))
getHeight :: (MonadDOM m) => DOMRect -> m Double
getHeight self = liftDOM ((self ^. js "height") >>= valToNumber)