module JSDOM.Generated.IntersectionObserver
(newIntersectionObserver, observe, unobserve, disconnect,
takeRecords, takeRecords_, getRoot, getRootUnsafe,
getRootUnchecked, getRootMargin, getThresholds,
IntersectionObserver(..), gTypeIntersectionObserver)
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)
import JSDOM.Enums
newIntersectionObserver ::
(MonadDOM m) =>
IntersectionObserverCallback ->
Maybe IntersectionObserverInit -> m IntersectionObserver
newIntersectionObserver callback options
= liftDOM
(IntersectionObserver <$>
new (jsg "IntersectionObserver")
[toJSVal callback, toJSVal options])
observe ::
(MonadDOM m, IsElement target) =>
IntersectionObserver -> target -> m ()
observe self target
= liftDOM (void (self ^. jsf "observe" [toJSVal target]))
unobserve ::
(MonadDOM m, IsElement target) =>
IntersectionObserver -> target -> m ()
unobserve self target
= liftDOM (void (self ^. jsf "unobserve" [toJSVal target]))
disconnect :: (MonadDOM m) => IntersectionObserver -> m ()
disconnect self = liftDOM (void (self ^. jsf "disconnect" ()))
takeRecords ::
(MonadDOM m) =>
IntersectionObserver -> m [IntersectionObserverEntry]
takeRecords self
= liftDOM ((self ^. jsf "takeRecords" ()) >>= fromJSArrayUnchecked)
takeRecords_ :: (MonadDOM m) => IntersectionObserver -> m ()
takeRecords_ self = liftDOM (void (self ^. jsf "takeRecords" ()))
getRoot ::
(MonadDOM m) => IntersectionObserver -> m (Maybe Element)
getRoot self = liftDOM ((self ^. js "root") >>= fromJSVal)
getRootUnsafe ::
(MonadDOM m, HasCallStack) => IntersectionObserver -> m Element
getRootUnsafe self
= liftDOM
(((self ^. js "root") >>= fromJSVal) >>=
maybe (Prelude.error "Nothing to return") return)
getRootUnchecked ::
(MonadDOM m) => IntersectionObserver -> m Element
getRootUnchecked self
= liftDOM ((self ^. js "root") >>= fromJSValUnchecked)
getRootMargin ::
(MonadDOM m, FromJSString result) =>
IntersectionObserver -> m result
getRootMargin self
= liftDOM ((self ^. js "rootMargin") >>= fromJSValUnchecked)
getThresholds :: (MonadDOM m) => IntersectionObserver -> m [Double]
getThresholds self
= liftDOM ((self ^. js "thresholds") >>= fromJSArrayUnchecked)