packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from cssom-view-1 (webref). Do not edit.
module JSDOM.Generated.Screen
       (getAvailWidth, getAvailHeight, getWidth, getHeight, getColorDepth, getPixelDepth, getOrientation, Screen(..), gTypeScreen, IsScreen, toScreen)
       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://developer.mozilla.org/docs/Web/API/Screen/availWidth MDN Screen.availWidth documentation>
getAvailWidth :: (MonadDOM m, IsScreen self) => self -> m Int
getAvailWidth self = liftDOM ((P.round <$> (((Types.toScreen self) ^. js "availWidth") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/Screen/availHeight MDN Screen.availHeight documentation>
getAvailHeight :: (MonadDOM m, IsScreen self) => self -> m Int
getAvailHeight self = liftDOM ((P.round <$> (((Types.toScreen self) ^. js "availHeight") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/Screen/width MDN Screen.width documentation>
getWidth :: (MonadDOM m, IsScreen self) => self -> m Int
getWidth self = liftDOM ((P.round <$> (((Types.toScreen self) ^. js "width") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/Screen/height MDN Screen.height documentation>
getHeight :: (MonadDOM m, IsScreen self) => self -> m Int
getHeight self = liftDOM ((P.round <$> (((Types.toScreen self) ^. js "height") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/Screen/colorDepth MDN Screen.colorDepth documentation>
getColorDepth :: (MonadDOM m, IsScreen self) => self -> m Word
getColorDepth self = liftDOM ((P.round <$> (((Types.toScreen self) ^. js "colorDepth") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/Screen/pixelDepth MDN Screen.pixelDepth documentation>
getPixelDepth :: (MonadDOM m, IsScreen self) => self -> m Word
getPixelDepth self = liftDOM ((P.round <$> (((Types.toScreen self) ^. js "pixelDepth") >>= valToNumber)))

-- | <https://developer.mozilla.org/docs/Web/API/Screen/orientation MDN Screen.orientation documentation>
getOrientation :: (MonadDOM m, IsScreen self) => self -> m ScreenOrientation
getOrientation self = liftDOM ((((Types.toScreen self) ^. js "orientation") >>= fromJSValUnchecked))