jsaddle-dom-0.10.0.0: src/JSDOM/Generated/IntersectionObserverEntry.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from intersection-observer (webref). Do not edit.
module JSDOM.Generated.IntersectionObserverEntry
(newIntersectionObserverEntry, getTime, getRootBounds, getRootBoundsUnsafe, getRootBoundsUnchecked, getBoundingClientRect, getIntersectionRect, getIsIntersecting, getIntersectionRatio, getTarget, IntersectionObserverEntry(..), gTypeIntersectionObserverEntry)
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/IntersectionObserverEntry/IntersectionObserverEntry MDN IntersectionObserverEntry. documentation>
newIntersectionObserverEntry :: (MonadDOM m) => IntersectionObserverEntryInit -> m IntersectionObserverEntry
newIntersectionObserverEntry intersectionObserverEntryInit = liftDOM (((new (jsg "IntersectionObserverEntry") [toJSVal intersectionObserverEntryInit]) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/time MDN IntersectionObserverEntry.time documentation>
getTime :: (MonadDOM m) => IntersectionObserverEntry -> m Double
getTime self = liftDOM (((self ^. js "time") >>= valToNumber))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/rootBounds MDN IntersectionObserverEntry.rootBounds documentation>
getRootBounds :: (MonadDOM m) => IntersectionObserverEntry -> m (Maybe DOMRectReadOnly)
getRootBounds self = liftDOM (((self ^. js "rootBounds") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/rootBounds MDN IntersectionObserverEntry.rootBounds documentation>
getRootBoundsUnsafe :: (MonadDOM m, HasCallStack) => IntersectionObserverEntry -> m DOMRectReadOnly
getRootBoundsUnsafe self = liftDOM ((((self ^. js "rootBounds") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/rootBounds MDN IntersectionObserverEntry.rootBounds documentation>
getRootBoundsUnchecked :: (MonadDOM m) => IntersectionObserverEntry -> m DOMRectReadOnly
getRootBoundsUnchecked self = liftDOM (((self ^. js "rootBounds") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/boundingClientRect MDN IntersectionObserverEntry.boundingClientRect documentation>
getBoundingClientRect :: (MonadDOM m) => IntersectionObserverEntry -> m DOMRectReadOnly
getBoundingClientRect self = liftDOM (((self ^. js "boundingClientRect") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/intersectionRect MDN IntersectionObserverEntry.intersectionRect documentation>
getIntersectionRect :: (MonadDOM m) => IntersectionObserverEntry -> m DOMRectReadOnly
getIntersectionRect self = liftDOM (((self ^. js "intersectionRect") >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/isIntersecting MDN IntersectionObserverEntry.isIntersecting documentation>
getIsIntersecting :: (MonadDOM m) => IntersectionObserverEntry -> m Bool
getIsIntersecting self = liftDOM (((self ^. js "isIntersecting") >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/intersectionRatio MDN IntersectionObserverEntry.intersectionRatio documentation>
getIntersectionRatio :: (MonadDOM m) => IntersectionObserverEntry -> m Double
getIntersectionRatio self = liftDOM (((self ^. js "intersectionRatio") >>= valToNumber))
-- | <https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/target MDN IntersectionObserverEntry.target documentation>
getTarget :: (MonadDOM m) => IntersectionObserverEntry -> m Element
getTarget self = liftDOM (((self ^. js "target") >>= fromJSValUnchecked))