{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.IntersectionObserverCallback
(newIntersectionObserverCallback,
newIntersectionObserverCallbackSync,
newIntersectionObserverCallbackAsync, IntersectionObserverCallback)
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
newIntersectionObserverCallback ::
(MonadDOM m) =>
([IntersectionObserverEntry] -> IntersectionObserver -> JSM ()) ->
m IntersectionObserverCallback
newIntersectionObserverCallback :: forall (m :: * -> *).
MonadDOM m =>
([IntersectionObserverEntry] -> IntersectionObserver -> JSM ())
-> m IntersectionObserverCallback
newIntersectionObserverCallback [IntersectionObserverEntry] -> IntersectionObserver -> JSM ()
callback
= DOM IntersectionObserverCallback -> m IntersectionObserverCallback
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(Callback (JSVal -> JSVal -> IO ()) -> IntersectionObserverCallback
IntersectionObserverCallback (Callback (JSVal -> JSVal -> IO ())
-> IntersectionObserverCallback)
-> (Function -> Callback (JSVal -> JSVal -> IO ()))
-> Function
-> IntersectionObserverCallback
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Function -> Callback (JSVal -> JSVal -> IO ())
forall a. Function -> Callback a
Callback (Function -> IntersectionObserverCallback)
-> JSM Function -> DOM IntersectionObserverCallback
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
JSCallAsFunction -> JSM Function
function
(\ JSVal
_ JSVal
_ [JSVal
entries, JSVal
observer] ->
JSVal -> JSM IntersectionObserver
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked JSVal
observer JSM IntersectionObserver
-> (IntersectionObserver -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
\ IntersectionObserver
observer' ->
JSVal -> JSM [IntersectionObserverEntry]
forall o. FromJSVal o => JSVal -> JSM [o]
fromJSArrayUnchecked JSVal
entries JSM [IntersectionObserverEntry]
-> ([IntersectionObserverEntry] -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ [IntersectionObserverEntry]
entries' -> [IntersectionObserverEntry] -> IntersectionObserver -> JSM ()
callback [IntersectionObserverEntry]
entries'
IntersectionObserver
observer'))
newIntersectionObserverCallbackSync ::
(MonadDOM m) =>
([IntersectionObserverEntry] ->
IntersectionObserver -> JSM ())
-> m IntersectionObserverCallback
newIntersectionObserverCallbackSync :: forall (m :: * -> *).
MonadDOM m =>
([IntersectionObserverEntry] -> IntersectionObserver -> JSM ())
-> m IntersectionObserverCallback
newIntersectionObserverCallbackSync [IntersectionObserverEntry] -> IntersectionObserver -> JSM ()
callback
= DOM IntersectionObserverCallback -> m IntersectionObserverCallback
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(Callback (JSVal -> JSVal -> IO ()) -> IntersectionObserverCallback
IntersectionObserverCallback (Callback (JSVal -> JSVal -> IO ())
-> IntersectionObserverCallback)
-> (Function -> Callback (JSVal -> JSVal -> IO ()))
-> Function
-> IntersectionObserverCallback
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Function -> Callback (JSVal -> JSVal -> IO ())
forall a. Function -> Callback a
Callback (Function -> IntersectionObserverCallback)
-> JSM Function -> DOM IntersectionObserverCallback
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
JSCallAsFunction -> JSM Function
function
(\ JSVal
_ JSVal
_ [JSVal
entries, JSVal
observer] ->
JSVal -> JSM IntersectionObserver
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked JSVal
observer JSM IntersectionObserver
-> (IntersectionObserver -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
\ IntersectionObserver
observer' ->
JSVal -> JSM [IntersectionObserverEntry]
forall o. FromJSVal o => JSVal -> JSM [o]
fromJSArrayUnchecked JSVal
entries JSM [IntersectionObserverEntry]
-> ([IntersectionObserverEntry] -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ [IntersectionObserverEntry]
entries' -> [IntersectionObserverEntry] -> IntersectionObserver -> JSM ()
callback [IntersectionObserverEntry]
entries'
IntersectionObserver
observer'))
newIntersectionObserverCallbackAsync ::
(MonadDOM m) =>
([IntersectionObserverEntry] ->
IntersectionObserver -> JSM ())
-> m IntersectionObserverCallback
newIntersectionObserverCallbackAsync :: forall (m :: * -> *).
MonadDOM m =>
([IntersectionObserverEntry] -> IntersectionObserver -> JSM ())
-> m IntersectionObserverCallback
newIntersectionObserverCallbackAsync [IntersectionObserverEntry] -> IntersectionObserver -> JSM ()
callback
= DOM IntersectionObserverCallback -> m IntersectionObserverCallback
forall (m :: * -> *) a. MonadDOM m => DOM a -> m a
liftDOM
(Callback (JSVal -> JSVal -> IO ()) -> IntersectionObserverCallback
IntersectionObserverCallback (Callback (JSVal -> JSVal -> IO ())
-> IntersectionObserverCallback)
-> (Function -> Callback (JSVal -> JSVal -> IO ()))
-> Function
-> IntersectionObserverCallback
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Function -> Callback (JSVal -> JSVal -> IO ())
forall a. Function -> Callback a
Callback (Function -> IntersectionObserverCallback)
-> JSM Function -> DOM IntersectionObserverCallback
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
JSCallAsFunction -> JSM Function
asyncFunction
(\ JSVal
_ JSVal
_ [JSVal
entries, JSVal
observer] ->
JSVal -> JSM IntersectionObserver
forall a. FromJSVal a => JSVal -> JSM a
fromJSValUnchecked JSVal
observer JSM IntersectionObserver
-> (IntersectionObserver -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>=
\ IntersectionObserver
observer' ->
JSVal -> JSM [IntersectionObserverEntry]
forall o. FromJSVal o => JSVal -> JSM [o]
fromJSArrayUnchecked JSVal
entries JSM [IntersectionObserverEntry]
-> ([IntersectionObserverEntry] -> JSM ()) -> JSM ()
forall a b. JSM a -> (a -> JSM b) -> JSM b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ [IntersectionObserverEntry]
entries' -> [IntersectionObserverEntry] -> IntersectionObserver -> JSM ()
callback [IntersectionObserverEntry]
entries'
IntersectionObserver
observer'))