-----------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Miso.Native.Element.View.Event
-- Copyright   :  (C) 2016-2026 David M. Johnson
-- License     :  BSD3-style (see the file LICENSE)
-- Maintainer  :  David M. Johnson <code@dmj.io>
-- Stability   :  experimental
-- Portability :  non-portable
----------------------------------------------------------------------------
module Miso.Native.Element.View.Event
  ( -- *** Events
    onTouchStart
  , onTouchStartWith
  , onTouchStartMain
  , onTouchStartMainWith
  , onTouchMove
  , onTouchMoveWith
  , onTouchMoveMain
  , onTouchMoveMainWith
  , onTouchEnd
  , onTouchEndWith
  , onTouchEndMain
  , onTouchEndMainWith
  , onTouchCancel
  , onTouchCancelWith
  , onTouchCancelMain
  , onTouchCancelMainWith
  , onTap
  , onTapMain
  , onTapWith
  , onTapMainWith
  , onTapMainModel
  , onLongPress
  , onLongPressWith
  , onLongPressMain
  , onLongPressMainWith
  , onLayoutChange
  , onLayoutChangeWith
  , onLayoutChangeMain
  , onLayoutChangeMainWith
  , onAppear
  , onAppearWith
  , onAppearMain
  , onAppearMainWith
  , onDisappear
  , onDisappearWith
  , onDisappearMain
  , onDisappearMainWith
  , onAnimationStart
  , onAnimationStartWith
  , onAnimationStartMain
  , onAnimationStartMainWith
  , onAnimationEnd
  , onAnimationEndWith
  , onAnimationEndMain
  , onAnimationEndMainWith
  , onAnimationCancel
  , onAnimationCancelWith
  , onAnimationCancelMain
  , onAnimationCancelMainWith
  , onAnimationIteration
  , onAnimationIterationWith
  , onAnimationIterationMain
  , onAnimationIterationMainWith
  , onTransitionStart
  , onTransitionStartWith
  , onTransitionStartMain
  , onTransitionStartMainWith
  , onTransitionEnd
  , onTransitionEndWith
  , onTransitionEndMain
  , onTransitionEndMainWith
  , onTransitionCancel
  , onTransitionCancelWith
  , onTransitionCancelMain
  , onTransitionCancelMainWith
    -- *** Types
  , TouchEvent (..)
  , AnimationEvent (..)
  , LayoutChangeDetailEvent (..)
  , UIAppearanceDetailEvent (..)
    -- *** Decoders
  , touchDecoder
  , animationDecoder
  , layoutChangeDetailDecoder
  , uiAppearanceDetailDecoder
    -- *** Event Map
  , viewEvents
  ) where
----------------------------------------------------------------------------
#if __GLASGOW_HASKELL__ <= 881
import Control.Applicative (liftA2)
#endif
-----------------------------------------------------------------------------
import qualified Data.Map as M
import           Miso.Event (on, onMain, Decoder(..), DecodeTarget(..), Events, emptyDecoder, Phase(BUBBLE))
import           Miso.JSON
import           Miso.String (MisoString)
import           Miso.Types (Attribute, EventHandler, DOMRef)
----------------------------------------------------------------------------
viewEvents :: Events
viewEvents :: Events
viewEvents = [(MisoString, Phase)] -> Events
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
  [ (MisoString
"touchstart", Phase
BUBBLE)
  , (MisoString
"touchmove", Phase
BUBBLE)
  , (MisoString
"touchend", Phase
BUBBLE)
  , (MisoString
"touchcancel", Phase
BUBBLE)
  , (MisoString
"tap", Phase
BUBBLE)
  , (MisoString
"longpress", Phase
BUBBLE)
  , (MisoString
"layoutchange", Phase
BUBBLE)
  , (MisoString
"uiappear", Phase
BUBBLE)
  , (MisoString
"uidisappear", Phase
BUBBLE)
  , (MisoString
"animationstart", Phase
BUBBLE)
  , (MisoString
"animationend", Phase
BUBBLE)
  , (MisoString
"animationcancel", Phase
BUBBLE)
  , (MisoString
"animationiteration", Phase
BUBBLE)
  , (MisoString
"transitionstart", Phase
BUBBLE)
  , (MisoString
"transitionend", Phase
BUBBLE)
  , (MisoString
"transitioncancel", Phase
BUBBLE)
  ]
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/lynx-api/event/touch-event.html
data TouchEvent
  = TouchEvent
  { TouchEvent -> Double
identifier :: Double
    -- ^ Unique identifier of the touch point, which remains
    -- unchanged during the same touch process
  , TouchEvent -> (Double, Double)
xy :: (Double, Double)
    -- ^ The horizontal / vertical position of the touch point in the
    -- coordinate system of the element actually touched
  , TouchEvent -> (Double, Double)
page :: (Double, Double)
    -- ^ The horizontal / vertical position of the touch point in the
    -- current LynxView coordinate system
  , TouchEvent -> (Double, Double)
client :: (Double, Double)
    -- ^ The horizontal / vertical position of the touch point in the
    -- current window coordinate system
  } deriving (Int -> TouchEvent -> ShowS
[TouchEvent] -> ShowS
TouchEvent -> String
(Int -> TouchEvent -> ShowS)
-> (TouchEvent -> String)
-> ([TouchEvent] -> ShowS)
-> Show TouchEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TouchEvent -> ShowS
showsPrec :: Int -> TouchEvent -> ShowS
$cshow :: TouchEvent -> String
show :: TouchEvent -> String
$cshowList :: [TouchEvent] -> ShowS
showList :: [TouchEvent] -> ShowS
Show, TouchEvent -> TouchEvent -> Bool
(TouchEvent -> TouchEvent -> Bool)
-> (TouchEvent -> TouchEvent -> Bool) -> Eq TouchEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TouchEvent -> TouchEvent -> Bool
== :: TouchEvent -> TouchEvent -> Bool
$c/= :: TouchEvent -> TouchEvent -> Bool
/= :: TouchEvent -> TouchEvent -> Bool
Eq)
----------------------------------------------------------------------------
-- | Touch decoder for use with events like 'onTap'
touchDecoder :: Decoder TouchEvent
touchDecoder :: Decoder TouchEvent
touchDecoder = Decoder {DecodeTarget
Value -> Parser TouchEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser TouchEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser TouchEvent
..}
  where
    pair :: Object -> MisoString -> MisoString -> Parser (a, b)
pair Object
o MisoString
x MisoString
y = (a -> b -> (a, b)) -> Parser a -> Parser b -> Parser (a, b)
forall a b c. (a -> b -> c) -> Parser a -> Parser b -> Parser c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (,) (Object
o Object -> MisoString -> Parser a
forall a. FromJSON a => Object -> MisoString -> Parser a
.: MisoString
x) (Object
o Object -> MisoString -> Parser b
forall a. FromJSON a => Object -> MisoString -> Parser a
.: MisoString
y)
    -- Lynx nests touch fields inside `changedTouches` / `touches` arrays (each a
    -- `Touch` with identifier/x/y/pageX/pageY/clientX/clientY); the browser-style
    -- flat root has no `identifier`. Read the first changed touch point.
    decodeAt :: DecodeTarget
decodeAt = [MisoString] -> DecodeTarget
DecodeTarget [MisoString
"changedTouches", MisoString
"0"]
    decoder :: Value -> Parser TouchEvent
decoder = MisoString
-> (Object -> Parser TouchEvent) -> Value -> Parser TouchEvent
forall a. MisoString -> (Object -> Parser a) -> Value -> Parser a
withObject MisoString
"touchDecoder" ((Object -> Parser TouchEvent) -> Value -> Parser TouchEvent)
-> (Object -> Parser TouchEvent) -> Value -> Parser TouchEvent
forall a b. (a -> b) -> a -> b
$ \Object
o ->
       Double
-> (Double, Double)
-> (Double, Double)
-> (Double, Double)
-> TouchEvent
TouchEvent
        (Double
 -> (Double, Double)
 -> (Double, Double)
 -> (Double, Double)
 -> TouchEvent)
-> Parser Double
-> Parser
     ((Double, Double)
      -> (Double, Double) -> (Double, Double) -> TouchEvent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> MisoString -> Parser Double
forall a. FromJSON a => Object -> MisoString -> Parser a
.: MisoString
"identifier"
        Parser
  ((Double, Double)
   -> (Double, Double) -> (Double, Double) -> TouchEvent)
-> Parser (Double, Double)
-> Parser ((Double, Double) -> (Double, Double) -> TouchEvent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object -> MisoString -> MisoString -> Parser (Double, Double)
forall {a} {b}.
(FromJSON a, FromJSON b) =>
Object -> MisoString -> MisoString -> Parser (a, b)
pair Object
o MisoString
"x" MisoString
"y"
        Parser ((Double, Double) -> (Double, Double) -> TouchEvent)
-> Parser (Double, Double)
-> Parser ((Double, Double) -> TouchEvent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object -> MisoString -> MisoString -> Parser (Double, Double)
forall {a} {b}.
(FromJSON a, FromJSON b) =>
Object -> MisoString -> MisoString -> Parser (a, b)
pair Object
o MisoString
"pageX" MisoString
"pageY"
        Parser ((Double, Double) -> TouchEvent)
-> Parser (Double, Double) -> Parser TouchEvent
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object -> MisoString -> MisoString -> Parser (Double, Double)
forall {a} {b}.
(FromJSON a, FromJSON b) =>
Object -> MisoString -> MisoString -> Parser (a, b)
pair Object
o MisoString
"clientX" MisoString
"clientY"
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/lynx-api/event/animation-event.html
data AnimationEvent
  = AnimationEvent
  { AnimationEvent -> AnimationType
animationType :: AnimationType
    -- ^ The type of the animation. If it is a keyframe animation,
    -- this value is `keyframe-animation`; if it is a transition animation,
    -- this value is `transition-animation`.
  , AnimationEvent -> MisoString
animationName :: MisoString
    -- ^ The name of the animation. If it is a keyframe animation, it
    -- is the name of `@keyframes` in CSS; if it is a transition animation,
    -- it is the name of `transition-property` in CSS.
  , AnimationEvent -> Bool
newAnimator :: Bool
    -- ^ Default value 'True'
  } deriving (Int -> AnimationEvent -> ShowS
[AnimationEvent] -> ShowS
AnimationEvent -> String
(Int -> AnimationEvent -> ShowS)
-> (AnimationEvent -> String)
-> ([AnimationEvent] -> ShowS)
-> Show AnimationEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AnimationEvent -> ShowS
showsPrec :: Int -> AnimationEvent -> ShowS
$cshow :: AnimationEvent -> String
show :: AnimationEvent -> String
$cshowList :: [AnimationEvent] -> ShowS
showList :: [AnimationEvent] -> ShowS
Show, AnimationEvent -> AnimationEvent -> Bool
(AnimationEvent -> AnimationEvent -> Bool)
-> (AnimationEvent -> AnimationEvent -> Bool) -> Eq AnimationEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AnimationEvent -> AnimationEvent -> Bool
== :: AnimationEvent -> AnimationEvent -> Bool
$c/= :: AnimationEvent -> AnimationEvent -> Bool
/= :: AnimationEvent -> AnimationEvent -> Bool
Eq)
----------------------------------------------------------------------------
data AnimationType
  = KeyFrameAnimation
  | TransitionAnimation
  deriving (Int -> AnimationType -> ShowS
[AnimationType] -> ShowS
AnimationType -> String
(Int -> AnimationType -> ShowS)
-> (AnimationType -> String)
-> ([AnimationType] -> ShowS)
-> Show AnimationType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AnimationType -> ShowS
showsPrec :: Int -> AnimationType -> ShowS
$cshow :: AnimationType -> String
show :: AnimationType -> String
$cshowList :: [AnimationType] -> ShowS
showList :: [AnimationType] -> ShowS
Show, AnimationType -> AnimationType -> Bool
(AnimationType -> AnimationType -> Bool)
-> (AnimationType -> AnimationType -> Bool) -> Eq AnimationType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AnimationType -> AnimationType -> Bool
== :: AnimationType -> AnimationType -> Bool
$c/= :: AnimationType -> AnimationType -> Bool
/= :: AnimationType -> AnimationType -> Bool
Eq)
----------------------------------------------------------------------------
instance FromJSON AnimationType where
  parseJSON :: Value -> Parser AnimationType
parseJSON = MisoString
-> (MisoString -> Parser AnimationType)
-> Value
-> Parser AnimationType
forall a.
MisoString -> (MisoString -> Parser a) -> Value -> Parser a
withText MisoString
"animation-type" ((MisoString -> Parser AnimationType)
 -> Value -> Parser AnimationType)
-> (MisoString -> Parser AnimationType)
-> Value
-> Parser AnimationType
forall a b. (a -> b) -> a -> b
$ \case
    MisoString
"keyframe-animation" -> AnimationType -> Parser AnimationType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure AnimationType
KeyFrameAnimation
    MisoString
"transition-animation" -> AnimationType -> Parser AnimationType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure AnimationType
TransitionAnimation
    MisoString
x -> MisoString -> Value -> Parser AnimationType
forall a. MisoString -> Value -> Parser a
typeMismatch MisoString
"animation-type" (MisoString -> Value
String MisoString
x)
----------------------------------------------------------------------------
-- | Animation decoder for use with events like 'onAnimationStart'
animationDecoder :: Decoder AnimationEvent
animationDecoder :: Decoder AnimationEvent
animationDecoder = Decoder {DecodeTarget
Value -> Parser AnimationEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser AnimationEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser AnimationEvent
..}
  where
    decodeAt :: DecodeTarget
decodeAt = [MisoString] -> DecodeTarget
DecodeTarget [MisoString]
forall a. Monoid a => a
mempty
    decoder :: Value -> Parser AnimationEvent
decoder = MisoString
-> (Object -> Parser AnimationEvent)
-> Value
-> Parser AnimationEvent
forall a. MisoString -> (Object -> Parser a) -> Value -> Parser a
withObject MisoString
"animationDecoder" ((Object -> Parser AnimationEvent)
 -> Value -> Parser AnimationEvent)
-> (Object -> Parser AnimationEvent)
-> Value
-> Parser AnimationEvent
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
      d <- Object
o Object -> MisoString -> Parser Object
forall a. FromJSON a => Object -> MisoString -> Parser a
.: MisoString
"detail"
      AnimationEvent
        <$> d .: "animation_type"
        <*> d .: "animation_name"
        <*> d .: "new_animator"
-----------------------------------------------------------------------------
data LayoutChangeDetailEvent
  = LayoutChangeDetailEvent
  { LayoutChangeDetailEvent -> MisoString
layoutChangeDetailEventId :: MisoString
    -- ^ The id selector of the target.
  , LayoutChangeDetailEvent -> Double
layoutChangeDetailEventWidth :: Double
    -- ^ The width of the target.
  , LayoutChangeDetailEvent -> Double
layoutChangeDetailEventHeight :: Double
    -- ^ The height of the target.
  , LayoutChangeDetailEvent -> Double
layoutChangeDetailEventTop :: Double
    -- ^ The top of the target.
  , LayoutChangeDetailEvent -> Double
layoutChangeDetailEventRight :: Double
    -- ^ The right of the target.
  , LayoutChangeDetailEvent -> Double
layoutChangeDetailEventBottom :: Double
    -- ^ The bottom of the target.
  , LayoutChangeDetailEvent -> Double
layoutChangeDetailEventLeft :: Double
    -- ^ The left of the target.
  , LayoutChangeDetailEvent -> Object
layoutChangeDetailEventDataset :: Object
    -- ^ The dataset of the target.
  } deriving (Int -> LayoutChangeDetailEvent -> ShowS
[LayoutChangeDetailEvent] -> ShowS
LayoutChangeDetailEvent -> String
(Int -> LayoutChangeDetailEvent -> ShowS)
-> (LayoutChangeDetailEvent -> String)
-> ([LayoutChangeDetailEvent] -> ShowS)
-> Show LayoutChangeDetailEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LayoutChangeDetailEvent -> ShowS
showsPrec :: Int -> LayoutChangeDetailEvent -> ShowS
$cshow :: LayoutChangeDetailEvent -> String
show :: LayoutChangeDetailEvent -> String
$cshowList :: [LayoutChangeDetailEvent] -> ShowS
showList :: [LayoutChangeDetailEvent] -> ShowS
Show, LayoutChangeDetailEvent -> LayoutChangeDetailEvent -> Bool
(LayoutChangeDetailEvent -> LayoutChangeDetailEvent -> Bool)
-> (LayoutChangeDetailEvent -> LayoutChangeDetailEvent -> Bool)
-> Eq LayoutChangeDetailEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LayoutChangeDetailEvent -> LayoutChangeDetailEvent -> Bool
== :: LayoutChangeDetailEvent -> LayoutChangeDetailEvent -> Bool
$c/= :: LayoutChangeDetailEvent -> LayoutChangeDetailEvent -> Bool
/= :: LayoutChangeDetailEvent -> LayoutChangeDetailEvent -> Bool
Eq)
-----------------------------------------------------------------------------
layoutChangeDetailDecoder :: Decoder LayoutChangeDetailEvent
layoutChangeDetailDecoder :: Decoder LayoutChangeDetailEvent
layoutChangeDetailDecoder = Decoder {DecodeTarget
Value -> Parser LayoutChangeDetailEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser LayoutChangeDetailEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser LayoutChangeDetailEvent
..}
  where
    decodeAt :: DecodeTarget
decodeAt = [MisoString] -> DecodeTarget
DecodeTarget [MisoString]
forall a. Monoid a => a
mempty
    decoder :: Value -> Parser LayoutChangeDetailEvent
decoder = MisoString
-> (Object -> Parser LayoutChangeDetailEvent)
-> Value
-> Parser LayoutChangeDetailEvent
forall a. MisoString -> (Object -> Parser a) -> Value -> Parser a
withObject MisoString
"LayoutChangeDetailEvent" ((Object -> Parser LayoutChangeDetailEvent)
 -> Value -> Parser LayoutChangeDetailEvent)
-> (Object -> Parser LayoutChangeDetailEvent)
-> Value
-> Parser LayoutChangeDetailEvent
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
      d <- Object
o Object -> MisoString -> Parser Object
forall a. FromJSON a => Object -> MisoString -> Parser a
.: MisoString
"detail"
      LayoutChangeDetailEvent
        <$> d .: "id"
        <*> d .: "width"
        <*> d .: "height"
        <*> d .: "top"
        <*> d .: "right"
        <*> d .: "bottom"
        <*> d .: "left"
        <*> d .: "dataset"
-----------------------------------------------------------------------------
data UIAppearanceDetailEventType
  = UIAppear
  | UIDisappear
  deriving (Int -> UIAppearanceDetailEventType -> ShowS
[UIAppearanceDetailEventType] -> ShowS
UIAppearanceDetailEventType -> String
(Int -> UIAppearanceDetailEventType -> ShowS)
-> (UIAppearanceDetailEventType -> String)
-> ([UIAppearanceDetailEventType] -> ShowS)
-> Show UIAppearanceDetailEventType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UIAppearanceDetailEventType -> ShowS
showsPrec :: Int -> UIAppearanceDetailEventType -> ShowS
$cshow :: UIAppearanceDetailEventType -> String
show :: UIAppearanceDetailEventType -> String
$cshowList :: [UIAppearanceDetailEventType] -> ShowS
showList :: [UIAppearanceDetailEventType] -> ShowS
Show, UIAppearanceDetailEventType -> UIAppearanceDetailEventType -> Bool
(UIAppearanceDetailEventType
 -> UIAppearanceDetailEventType -> Bool)
-> (UIAppearanceDetailEventType
    -> UIAppearanceDetailEventType -> Bool)
-> Eq UIAppearanceDetailEventType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UIAppearanceDetailEventType -> UIAppearanceDetailEventType -> Bool
== :: UIAppearanceDetailEventType -> UIAppearanceDetailEventType -> Bool
$c/= :: UIAppearanceDetailEventType -> UIAppearanceDetailEventType -> Bool
/= :: UIAppearanceDetailEventType -> UIAppearanceDetailEventType -> Bool
Eq)
----------------------------------------------------------------------------
instance FromJSON UIAppearanceDetailEventType where
  parseJSON :: Value -> Parser UIAppearanceDetailEventType
parseJSON = MisoString
-> (MisoString -> Parser UIAppearanceDetailEventType)
-> Value
-> Parser UIAppearanceDetailEventType
forall a.
MisoString -> (MisoString -> Parser a) -> Value -> Parser a
withText MisoString
"UIAppearanceDetailEventType" ((MisoString -> Parser UIAppearanceDetailEventType)
 -> Value -> Parser UIAppearanceDetailEventType)
-> (MisoString -> Parser UIAppearanceDetailEventType)
-> Value
-> Parser UIAppearanceDetailEventType
forall a b. (a -> b) -> a -> b
$ \case
    MisoString
"uiappear" -> UIAppearanceDetailEventType -> Parser UIAppearanceDetailEventType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UIAppearanceDetailEventType
UIAppear
    MisoString
"uidisappear" -> UIAppearanceDetailEventType -> Parser UIAppearanceDetailEventType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure UIAppearanceDetailEventType
UIDisappear
    MisoString
x -> MisoString -> Value -> Parser UIAppearanceDetailEventType
forall a. MisoString -> Value -> Parser a
typeMismatch MisoString
"UIAppearanceDetailEventType" (MisoString -> Value
String MisoString
x)
-----------------------------------------------------------------------------
data UIAppearanceDetailEvent
  = UIAppearanceDetailEvent
  { UIAppearanceDetailEvent -> UIAppearanceDetailEventType
uiAppearanceDetailEventType :: UIAppearanceDetailEventType
  , UIAppearanceDetailEvent -> MisoString
uiAppearanceDetailEventExposureId :: MisoString
  , UIAppearanceDetailEvent -> MisoString
uiAppearanceDetailEventExposureScene :: MisoString
  , UIAppearanceDetailEvent -> MisoString
uiAppearanceDetailEventUniqueId :: MisoString
  , UIAppearanceDetailEvent -> Object
uiAppearanceDetailEventDataset :: Object
  } deriving (Int -> UIAppearanceDetailEvent -> ShowS
[UIAppearanceDetailEvent] -> ShowS
UIAppearanceDetailEvent -> String
(Int -> UIAppearanceDetailEvent -> ShowS)
-> (UIAppearanceDetailEvent -> String)
-> ([UIAppearanceDetailEvent] -> ShowS)
-> Show UIAppearanceDetailEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UIAppearanceDetailEvent -> ShowS
showsPrec :: Int -> UIAppearanceDetailEvent -> ShowS
$cshow :: UIAppearanceDetailEvent -> String
show :: UIAppearanceDetailEvent -> String
$cshowList :: [UIAppearanceDetailEvent] -> ShowS
showList :: [UIAppearanceDetailEvent] -> ShowS
Show, UIAppearanceDetailEvent -> UIAppearanceDetailEvent -> Bool
(UIAppearanceDetailEvent -> UIAppearanceDetailEvent -> Bool)
-> (UIAppearanceDetailEvent -> UIAppearanceDetailEvent -> Bool)
-> Eq UIAppearanceDetailEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UIAppearanceDetailEvent -> UIAppearanceDetailEvent -> Bool
== :: UIAppearanceDetailEvent -> UIAppearanceDetailEvent -> Bool
$c/= :: UIAppearanceDetailEvent -> UIAppearanceDetailEvent -> Bool
/= :: UIAppearanceDetailEvent -> UIAppearanceDetailEvent -> Bool
Eq)
-----------------------------------------------------------------------------
uiAppearanceDetailDecoder :: Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder :: Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder = Decoder {DecodeTarget
Value -> Parser UIAppearanceDetailEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser UIAppearanceDetailEvent
decodeAt :: DecodeTarget
decoder :: Value -> Parser UIAppearanceDetailEvent
..}
  where
    decodeAt :: DecodeTarget
decodeAt = [MisoString] -> DecodeTarget
DecodeTarget [MisoString]
forall a. Monoid a => a
mempty
    decoder :: Value -> Parser UIAppearanceDetailEvent
decoder = MisoString
-> (Object -> Parser UIAppearanceDetailEvent)
-> Value
-> Parser UIAppearanceDetailEvent
forall a. MisoString -> (Object -> Parser a) -> Value -> Parser a
withObject MisoString
"UIAppearanceDetailEvent" ((Object -> Parser UIAppearanceDetailEvent)
 -> Value -> Parser UIAppearanceDetailEvent)
-> (Object -> Parser UIAppearanceDetailEvent)
-> Value
-> Parser UIAppearanceDetailEvent
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
      d <- Object
o Object -> MisoString -> Parser Object
forall a. FromJSON a => Object -> MisoString -> Parser a
.: MisoString
"detail"
      UIAppearanceDetailEvent
        <$> o .: "type"
        <*> d .: "exposure-id"
        <*> d .: "exposure-scene"
        <*> d .: "unique-id"
        <*> d .: "dataset"
-----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#touchstart
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the finger starts to touch the touch surface.
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view model = view_ [ onTouchStart HandleTouch ]
--
-- update :: Action -> Effect props Model Action
-- update (HandleTouch TouchEvent {..}) = do
--   io_ (consoleLog "touch event received")
--
onTouchStart :: (TouchEvent -> action) -> Attribute model action
onTouchStart :: forall action model.
(TouchEvent -> action) -> Attribute model action
onTouchStart TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchstart" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#touchmove
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the finger moves on the touch surface.
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onTouchMove HandleTouch ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleTouch TouchEvent {..}) = do
--   io_ (consoleLog "touch event received")
--
-- @
--
onTouchMove :: (TouchEvent -> action) -> Attribute model action
onTouchMove :: forall action model.
(TouchEvent -> action) -> Attribute model action
onTouchMove TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchmove" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#touchend
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the finger leaves the touch surface.
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onTouchEnd HandleTouch ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleTouch TouchEvent {..}) = do
--   io_ (consoleLog "touch event received")
--
-- @
--
onTouchEnd :: (TouchEvent -> action) -> Attribute model action
onTouchEnd :: forall action model.
(TouchEvent -> action) -> Attribute model action
onTouchEnd TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchend" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#touchcancel
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- is interrupted by the system or Lynx external gesture.
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onTouchCancel HandleTouch ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleTouch TouchEvent {..}) =
--   io_ (consoleLog "touch event received")
--
-- @
--
onTouchCancel :: (TouchEvent -> action) -> Attribute model action
onTouchCancel :: forall action model.
(TouchEvent -> action) -> Attribute model action
onTouchCancel TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchcancel" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#tap
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the finger clicks on the touch surface.
--
-- @
-- data Action = HandleTap
--
-- view :: context -> props -> Model -> View context Action
-- view model = view_ [ onTap HandleTap ]
--
-- update :: Action -> Effect context props Model Action
-- update HandleTap = io_ (consoleLog "touch event received")
--
-- @
--
onTap :: action -> Attribute model action
onTap :: forall action model. action -> Attribute model action
onTap action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"tap" Decoder ()
emptyDecoder (\() model
_ DOMRef
_ -> action
action)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#tap
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the finger clicks on the touch surface.
--
-- Unlike 'onTap', 'onTapMain' is necessary for handling tap events on the main thread (MTS).
--
-- @
-- data Action = HandleTap
--
-- view :: context -> props -> Model -> View context Action
-- view model = view_ [ event $ static (onTapMain HandleTap) ]
--
-- update :: Action -> Effect context props Model Action
-- update HandleTap = io_ (consoleLog "touch event received")
--
-- @
--
onTapMain :: action -> EventHandler model action
onTapMain :: forall action model. action -> EventHandler model action
onTapMain action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"tap" Decoder ()
emptyDecoder (\() model
_ DOMRef
_ -> action
action)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#tap
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the finger clicks on the touch surface.
--
-- Unlike 'onTap', 'onTapMain' is necessary for handling tap events on the main thread (MTS).
--
-- @
-- data Action = HandleTap
--
-- view :: context -> props -> Model -> View context Action
-- view model = view_ [ event $ static (onTapMain HandleTap) ]
--
-- update :: Action -> Effect context props Model Action
-- update HandleTap = io_ (consoleLog "touch event received")
--
-- @
--
onTapMainWith :: (DOMRef -> action) -> EventHandler model action
onTapMainWith :: forall action model.
(DOMRef -> action) -> EventHandler model action
onTapMainWith DOMRef -> action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"tap" Decoder ()
emptyDecoder (\() model
_ -> DOMRef -> action
action)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#tap
--
-- It belongs to [touch event](https://lynxjs.org/api/lynx-api/event/touch-event.html),
-- which is triggered when the finger clicks on the touch surface.
--
-- Unlike 'onTap', 'onTapMain' is necessary for handling tap events on the main thread (MTS).
--
-- @
-- data Action = HandleTap
--
-- view :: context -> props -> Model -> View context Action
-- view model = view_ [ event $ static (onTapMain HandleTap) ]
--
-- update :: Action -> Effect context props Model Action
-- update HandleTap = io_ (consoleLog "touch event received")
--
-- @
--
onTapMainModel :: (model -> action) -> EventHandler model action
onTapMainModel :: forall model action. (model -> action) -> EventHandler model action
onTapMainModel model -> action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"tap" Decoder ()
emptyDecoder (\() model
m DOMRef
_ -> model -> action
action model
m)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#longpress
--
-- It belongs to the touch event, which is triggered when the finger is long
-- pressed on the touch surface, and the interval between long press triggers is `500 ms`.
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view :: context -> props -> Model -> View context Action
-- view model = view_ [ onLongPress HandleTouch ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleTouch TouchEvent {..}) = io_ (consoleLog "touch event received")
--
-- @
--
onLongPress :: (TouchEvent -> action) -> Attribute model action
onLongPress :: forall action model.
(TouchEvent -> action) -> Attribute model action
onLongPress TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"longpress" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#layoutchange
--
-- It belongs to a [custom event](https://lynxjs.org/api/lynx-api/event/custom-event.html), which is triggered when the target node layout
-- is completed, and returns the position information of the target node relative
-- to the LynxView viewport coordinate system.
--
-- @
-- data Action = HandleLayout LayoutChangeDetailEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onLayoutChange HandleLayout ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleLayout LayoutChangeDetailEvent {..}) =
--   io_ (consoleLog "layout changed")
-- @
--
onLayoutChange :: (LayoutChangeDetailEvent -> action) -> Attribute model action
onLayoutChange :: forall action model.
(LayoutChangeDetailEvent -> action) -> Attribute model action
onLayoutChange LayoutChangeDetailEvent -> action
action = MisoString
-> Decoder LayoutChangeDetailEvent
-> (LayoutChangeDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"layoutchange" Decoder LayoutChangeDetailEvent
layoutChangeDetailDecoder (\LayoutChangeDetailEvent
x model
_ DOMRef
_ -> LayoutChangeDetailEvent -> action
action LayoutChangeDetailEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#uiappear
--
-- It belongs to custom event, which is triggered when the target node appears on the screen.
--
-- @
-- data Action = HandleUI UIAppearanceDetailEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onAppear HandleUI ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleUI UIAppearanceDetailEvent {..}) = do
--   io_ (consoleLog "appearance detail event received")
-- @
--
onAppear :: (UIAppearanceDetailEvent -> action) -> Attribute model action
onAppear :: forall action model.
(UIAppearanceDetailEvent -> action) -> Attribute model action
onAppear UIAppearanceDetailEvent -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"uiappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder (\UIAppearanceDetailEvent
x model
_ DOMRef
_ -> UIAppearanceDetailEvent -> action
action UIAppearanceDetailEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#uidisappear
--
-- It belongs to custom event, which is triggered when the target node appears on the screen.
--
-- @
-- data Action = HandleUI UIAppearanceDetailEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onDisappear HandleUI ]
--
-- update :: Action -> Effect props Model Action
-- update (HandleUI UIAppearanceDetailEvent {..}) = do
--   io_ (consoleLog "appearance detail event received")
-- @
--
onDisappear :: (UIAppearanceDetailEvent -> action) -> Attribute model action
onDisappear :: forall action model.
(UIAppearanceDetailEvent -> action) -> Attribute model action
onDisappear UIAppearanceDetailEvent -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"uidisappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder (\UIAppearanceDetailEvent
x model
_ DOMRef
_ -> UIAppearanceDetailEvent -> action
action UIAppearanceDetailEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#animationstart
--
-- It belongs to [animation event](https://lynxjs.org/api/lynx-api/event/animation-event.html), which is triggered when the Animation animation starts.
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onAnimationStart HandleAnimation ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleAnimation AnimationEvent {..}) =
--   io_ (consoleLog "animation event received")
-- @
--
onAnimationStart :: (AnimationEvent -> action) -> Attribute model action
onAnimationStart :: forall action model.
(AnimationEvent -> action) -> Attribute model action
onAnimationStart AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationstart" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#animationend
--
-- It belongs to [animation event](https://lynxjs.org/api/lynx-api/event/animation-event.html), which is triggered when the Animation animation ends.
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view :: context -> props -> Model -> View context Action
-- view model = view_ [ onAnimationEnd HandleAnimation ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleAnimation AnimationEvent {..}) =
--   io_ (consoleLog "animation event received")
-- @
--
onAnimationEnd :: (AnimationEvent -> action) -> Attribute model action
onAnimationEnd :: forall action model.
(AnimationEvent -> action) -> Attribute model action
onAnimationEnd AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationend" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#animationcancel
--
-- It belongs to [animation event](https://lynxjs.org/api/lynx-api/event/animation-event.html), which is triggered when the Animation animation cancels.
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onAnimationCancel HandleAnimation ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleAnimation AnimationEvent {..}) =
--   io_ (consoleLog "animation event received")
-- @
--
onAnimationCancel :: (AnimationEvent -> action) -> Attribute model action
onAnimationCancel :: forall action model.
(AnimationEvent -> action) -> Attribute model action
onAnimationCancel AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationcancel" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#animationiteration
--
-- It belongs to [animation event](https://lynxjs.org/api/lynx-api/event/animation-event.html), which is triggered when the Animation animation iterates.
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onAnimationIteration HandleAnimation ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleAnimation AnimationEvent {..}) =
--   io_ (consoleLog "animation event received")
-- @
--
onAnimationIteration :: (AnimationEvent -> action) -> Attribute model action
onAnimationIteration :: forall action model.
(AnimationEvent -> action) -> Attribute model action
onAnimationIteration AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationiteration" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#transitionstart
--
-- It belongs to [animation event](https://lynxjs.org/api/lynx-api/event/animation-event.html), which is triggered when the Transition animation starts.
--
-- @
-- data Action = HandleTransition AnimationEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onTransitionStart HandleTransition ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleTransition TransitionEvent {..}) =
--   io_ (consoleLog "transition event received")
-- @
--
onTransitionStart :: (AnimationEvent -> action) -> Attribute model action
onTransitionStart :: forall action model.
(AnimationEvent -> action) -> Attribute model action
onTransitionStart AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"transitionstart" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#transitionend
--
-- It belongs to [animation event](https://lynxjs.org/api/lynx-api/event/animation-event.html), which is triggered when the Transition animation ends.
--
-- @
-- data Action = HandleTransition AnimationEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onTransitionEnd HandleTransition ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleTransition TransitionEvent {..}) =
--   io_ (consoleLog "transition event received")
-- @
--
onTransitionEnd :: (AnimationEvent -> action) -> Attribute model action
onTransitionEnd :: forall action model.
(AnimationEvent -> action) -> Attribute model action
onTransitionEnd AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"transitionend" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
----------------------------------------------------------------------------
-- | https://lynxjs.org/api/elements/built-in/view.html#transitioncancel
--
-- It belongs to [animation event](https://lynxjs.org/api/lynx-api/event/animation-event.html), which is triggered when the Transition animation cancels.
--
-- @
-- data Action = HandleTransition AnimationEvent
--
-- view :: context -> props -> Model -> View context Action
-- view _ _ model = view_ [ onTransitionCancel HandleTransition ]
--
-- update :: Action -> Effect context props Model Action
-- update (HandleTransition TransitionEvent {..}) =
--   io_ (consoleLog "transition event received")
-- @
--
onTransitionCancel :: (AnimationEvent -> action) -> Attribute model action
onTransitionCancel :: forall action model.
(AnimationEvent -> action) -> Attribute model action
onTransitionCancel AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"transitioncancel" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTouchStart', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTouchStartWith :: (TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchStartWith :: forall action model.
(TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchStartWith TouchEvent -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchstart" Decoder TouchEvent
touchDecoder ((TouchEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \TouchEvent
t model
_ DOMRef
d -> TouchEvent -> DOMRef -> action
action TouchEvent
t DOMRef
d
-----------------------------------------------------------------------------
-- | Like 'onTouchMove', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTouchMoveWith :: (TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchMoveWith :: forall action model.
(TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchMoveWith TouchEvent -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchmove" Decoder TouchEvent
touchDecoder ((TouchEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \TouchEvent
t model
_ DOMRef
d -> TouchEvent -> DOMRef -> action
action TouchEvent
t DOMRef
d
-----------------------------------------------------------------------------
-- | Like 'onTouchEnd', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTouchEndWith :: (TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchEndWith :: forall action model.
(TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchEndWith TouchEvent -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchend" Decoder TouchEvent
touchDecoder ((TouchEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \TouchEvent
t model
_ DOMRef
d -> TouchEvent -> DOMRef -> action
action TouchEvent
t DOMRef
d
-----------------------------------------------------------------------------
-- | Like 'onTouchCancel', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTouchCancelWith :: (TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchCancelWith :: forall action model.
(TouchEvent -> DOMRef -> action) -> Attribute model action
onTouchCancelWith TouchEvent -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"touchcancel" Decoder TouchEvent
touchDecoder ((TouchEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \TouchEvent
t model
_ DOMRef
d -> TouchEvent -> DOMRef -> action
action TouchEvent
t DOMRef
d
-----------------------------------------------------------------------------
-- | Like 'onTap', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTapWith :: (DOMRef -> action) -> Attribute model action
onTapWith :: forall action model. (DOMRef -> action) -> Attribute model action
onTapWith DOMRef -> action
action = MisoString
-> Decoder ()
-> (() -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"tap" Decoder ()
emptyDecoder (\() model
_ DOMRef
ref -> DOMRef -> action
action DOMRef
ref)
-----------------------------------------------------------------------------
-- | Like 'onLongPress', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onLongPressWith :: (TouchEvent -> DOMRef -> action) -> Attribute model action
onLongPressWith :: forall action model.
(TouchEvent -> DOMRef -> action) -> Attribute model action
onLongPressWith TouchEvent -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"longpress" Decoder TouchEvent
touchDecoder ((TouchEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (TouchEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \TouchEvent
t model
_ DOMRef
d -> TouchEvent -> DOMRef -> action
action TouchEvent
t DOMRef
d
-----------------------------------------------------------------------------
-- | Like 'onLayoutChange', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onLayoutChangeWith :: (LayoutChangeDetailEvent -> DOMRef -> action) -> Attribute model action
onLayoutChangeWith :: forall action model.
(LayoutChangeDetailEvent -> DOMRef -> action)
-> Attribute model action
onLayoutChangeWith LayoutChangeDetailEvent -> DOMRef -> action
action = MisoString
-> Decoder LayoutChangeDetailEvent
-> (LayoutChangeDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"layoutchange" Decoder LayoutChangeDetailEvent
layoutChangeDetailDecoder ((LayoutChangeDetailEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (LayoutChangeDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \LayoutChangeDetailEvent
lcde model
_ DOMRef
domRef -> LayoutChangeDetailEvent -> DOMRef -> action
action LayoutChangeDetailEvent
lcde DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onAppear', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onAppearWith :: (UIAppearanceDetailEvent -> DOMRef -> action) -> Attribute model action
onAppearWith :: forall action model.
(UIAppearanceDetailEvent -> DOMRef -> action)
-> Attribute model action
onAppearWith UIAppearanceDetailEvent -> DOMRef -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"uiappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder ((UIAppearanceDetailEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \UIAppearanceDetailEvent
ui model
_ DOMRef
domRef -> UIAppearanceDetailEvent -> DOMRef -> action
action UIAppearanceDetailEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onDisappear', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onDisappearWith :: (UIAppearanceDetailEvent -> DOMRef -> action) -> Attribute model action
onDisappearWith :: forall action model.
(UIAppearanceDetailEvent -> DOMRef -> action)
-> Attribute model action
onDisappearWith UIAppearanceDetailEvent -> DOMRef -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"uidisappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder ((UIAppearanceDetailEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \UIAppearanceDetailEvent
ui model
_ DOMRef
domRef -> UIAppearanceDetailEvent -> DOMRef -> action
action UIAppearanceDetailEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onAnimationStart', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onAnimationStartWith :: (AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationStartWith :: forall action model.
(AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationStartWith AnimationEvent -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationstart" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \AnimationEvent
ui model
_ DOMRef
domRef -> AnimationEvent -> DOMRef -> action
action AnimationEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onAnimationEnd', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onAnimationEndWith :: (AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationEndWith :: forall action model.
(AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationEndWith AnimationEvent -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationend" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \AnimationEvent
ui model
_ DOMRef
domRef -> AnimationEvent -> DOMRef -> action
action AnimationEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onAnimationCancel', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onAnimationCancelWith :: (AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationCancelWith :: forall action model.
(AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationCancelWith AnimationEvent -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationcancel" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \AnimationEvent
ui model
_ DOMRef
domRef -> AnimationEvent -> DOMRef -> action
action AnimationEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onAnimationIteration', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onAnimationIterationWith :: (AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationIterationWith :: forall action model.
(AnimationEvent -> DOMRef -> action) -> Attribute model action
onAnimationIterationWith AnimationEvent -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"animationiteration" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \AnimationEvent
ui model
_ DOMRef
domRef -> AnimationEvent -> DOMRef -> action
action AnimationEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onTransitionStart', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTransitionStartWith :: (AnimationEvent -> DOMRef -> action) -> Attribute model action
onTransitionStartWith :: forall action model.
(AnimationEvent -> DOMRef -> action) -> Attribute model action
onTransitionStartWith AnimationEvent -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"transitionstart" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \AnimationEvent
ui model
_ DOMRef
domRef -> AnimationEvent -> DOMRef -> action
action AnimationEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onTransitionEnd', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTransitionEndWith :: (AnimationEvent -> DOMRef -> action) -> Attribute model action
onTransitionEndWith :: forall action model.
(AnimationEvent -> DOMRef -> action) -> Attribute model action
onTransitionEndWith AnimationEvent -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"transitionend" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \AnimationEvent
ui model
_ DOMRef
domRef -> AnimationEvent -> DOMRef -> action
action AnimationEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- | Like 'onTransitionCancel', but the handler also receives the target element's 'DOMRef'.
-- Use for main-thread ('MTS') handlers that imperatively mutate the element.
onTransitionCancelWith :: (AnimationEvent -> DOMRef -> action) -> Attribute model action
onTransitionCancelWith :: forall action model.
(AnimationEvent -> DOMRef -> action) -> Attribute model action
onTransitionCancelWith AnimationEvent -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> Attribute model action
on MisoString
"transitioncancel" Decoder AnimationEvent
animationDecoder ((AnimationEvent -> model -> DOMRef -> action)
 -> Attribute model action)
-> (AnimationEvent -> model -> DOMRef -> action)
-> Attribute model action
forall a b. (a -> b) -> a -> b
$ \AnimationEvent
ui model
_ DOMRef
domRef -> AnimationEvent -> DOMRef -> action
action AnimationEvent
ui DOMRef
domRef
-----------------------------------------------------------------------------
-- Main-thread ('MTS') variants of the events above.
--
-- Each @on*Main@ is like its background counterpart but dispatched on the Lynx
-- __main thread__: it runs imperatively (no VDOM diff) and is meant to be used
-- with @-XStaticPointers@ via @event (static (…))@. Each @on*MainWith@
-- additionally hands the handler read-only access to the @model@ and the target
-- element's 'DOMRef' for imperative MTS mutation.
-----------------------------------------------------------------------------
-- | Like 'onTouchStart', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view_ [ event (static (onTouchStartMain HandleTouch)) ] [ "some view" ]
-- @
--
onTouchStartMain :: (TouchEvent -> action) -> EventHandler model action
onTouchStartMain :: forall action model.
(TouchEvent -> action) -> EventHandler model action
onTouchStartMain TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchstart" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTouchStartMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTouch TouchEvent Model DOMRef
--
-- view_ [ event (static (onTouchStartMainWith HandleTouch)) ] [ "some view" ]
-- @
--
onTouchStartMainWith :: (TouchEvent -> model -> DOMRef -> action) -> EventHandler model action
onTouchStartMainWith :: forall model action.
(TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
onTouchStartMainWith TouchEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchstart" Decoder TouchEvent
touchDecoder TouchEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onTouchMove', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view_ [ event (static (onTouchMoveMain HandleTouch)) ] [ "some view" ]
-- @
--
onTouchMoveMain :: (TouchEvent -> action) -> EventHandler model action
onTouchMoveMain :: forall action model.
(TouchEvent -> action) -> EventHandler model action
onTouchMoveMain TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchmove" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTouchMoveMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTouch TouchEvent Model DOMRef
--
-- view_ [ event (static (onTouchMoveMainWith HandleTouch)) ] [ "some view" ]
-- @
--
onTouchMoveMainWith :: (TouchEvent -> model -> DOMRef -> action) -> EventHandler model action
onTouchMoveMainWith :: forall model action.
(TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
onTouchMoveMainWith TouchEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchmove" Decoder TouchEvent
touchDecoder TouchEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onTouchEnd', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view_ [ event (static (onTouchEndMain HandleTouch)) ] [ "some view" ]
-- @
--
onTouchEndMain :: (TouchEvent -> action) -> EventHandler model action
onTouchEndMain :: forall action model.
(TouchEvent -> action) -> EventHandler model action
onTouchEndMain TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchend" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTouchEndMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTouch TouchEvent Model DOMRef
--
-- view_ [ event (static (onTouchEndMainWith HandleTouch)) ] [ "some view" ]
-- @
--
onTouchEndMainWith :: (TouchEvent -> model -> DOMRef -> action) -> EventHandler model action
onTouchEndMainWith :: forall model action.
(TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
onTouchEndMainWith TouchEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchend" Decoder TouchEvent
touchDecoder TouchEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onTouchCancel', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view_ [ event (static (onTouchCancelMain HandleTouch)) ] [ "some view" ]
-- @
--
onTouchCancelMain :: (TouchEvent -> action) -> EventHandler model action
onTouchCancelMain :: forall action model.
(TouchEvent -> action) -> EventHandler model action
onTouchCancelMain TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchcancel" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTouchCancelMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTouch TouchEvent Model DOMRef
--
-- view_ [ event (static (onTouchCancelMainWith HandleTouch)) ] [ "some view" ]
-- @
--
onTouchCancelMainWith :: (TouchEvent -> model -> DOMRef -> action) -> EventHandler model action
onTouchCancelMainWith :: forall model action.
(TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
onTouchCancelMainWith TouchEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"touchcancel" Decoder TouchEvent
touchDecoder TouchEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onLongPress', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTouch TouchEvent
--
-- view_ [ event (static (onLongPressMain HandleTouch)) ] [ "some view" ]
-- @
--
onLongPressMain :: (TouchEvent -> action) -> EventHandler model action
onLongPressMain :: forall action model.
(TouchEvent -> action) -> EventHandler model action
onLongPressMain TouchEvent -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"longpress" Decoder TouchEvent
touchDecoder (\TouchEvent
x model
_ DOMRef
_ -> TouchEvent -> action
action TouchEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onLongPressMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTouch TouchEvent Model DOMRef
--
-- view_ [ event (static (onLongPressMainWith HandleTouch)) ] [ "some view" ]
-- @
--
onLongPressMainWith :: (TouchEvent -> model -> DOMRef -> action) -> EventHandler model action
onLongPressMainWith :: forall model action.
(TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
onLongPressMainWith TouchEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder TouchEvent
-> (TouchEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"longpress" Decoder TouchEvent
touchDecoder TouchEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onLayoutChange', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleLayout LayoutChangeDetailEvent
--
-- view_ [ event (static (onLayoutChangeMain HandleLayout)) ] [ "some view" ]
-- @
--
onLayoutChangeMain :: (LayoutChangeDetailEvent -> action) -> EventHandler model action
onLayoutChangeMain :: forall action model.
(LayoutChangeDetailEvent -> action) -> EventHandler model action
onLayoutChangeMain LayoutChangeDetailEvent -> action
action = MisoString
-> Decoder LayoutChangeDetailEvent
-> (LayoutChangeDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"layoutchange" Decoder LayoutChangeDetailEvent
layoutChangeDetailDecoder (\LayoutChangeDetailEvent
x model
_ DOMRef
_ -> LayoutChangeDetailEvent -> action
action LayoutChangeDetailEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onLayoutChangeMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleLayout LayoutChangeDetailEvent Model DOMRef
--
-- view_ [ event (static (onLayoutChangeMainWith HandleLayout)) ] [ "some view" ]
-- @
--
onLayoutChangeMainWith :: (LayoutChangeDetailEvent -> model -> DOMRef -> action) -> EventHandler model action
onLayoutChangeMainWith :: forall model action.
(LayoutChangeDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
onLayoutChangeMainWith LayoutChangeDetailEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder LayoutChangeDetailEvent
-> (LayoutChangeDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"layoutchange" Decoder LayoutChangeDetailEvent
layoutChangeDetailDecoder LayoutChangeDetailEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onAppear', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleAppear UIAppearanceDetailEvent
--
-- view_ [ event (static (onAppearMain HandleAppear)) ] [ "some view" ]
-- @
--
onAppearMain :: (UIAppearanceDetailEvent -> action) -> EventHandler model action
onAppearMain :: forall action model.
(UIAppearanceDetailEvent -> action) -> EventHandler model action
onAppearMain UIAppearanceDetailEvent -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"uiappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder (\UIAppearanceDetailEvent
x model
_ DOMRef
_ -> UIAppearanceDetailEvent -> action
action UIAppearanceDetailEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onAppearMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleAppear UIAppearanceDetailEvent Model DOMRef
--
-- view_ [ event (static (onAppearMainWith HandleAppear)) ] [ "some view" ]
-- @
--
onAppearMainWith :: (UIAppearanceDetailEvent -> model -> DOMRef -> action) -> EventHandler model action
onAppearMainWith :: forall model action.
(UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
onAppearMainWith UIAppearanceDetailEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"uiappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder UIAppearanceDetailEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onDisappear', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleDisappear UIAppearanceDetailEvent
--
-- view_ [ event (static (onDisappearMain HandleDisappear)) ] [ "some view" ]
-- @
--
onDisappearMain :: (UIAppearanceDetailEvent -> action) -> EventHandler model action
onDisappearMain :: forall action model.
(UIAppearanceDetailEvent -> action) -> EventHandler model action
onDisappearMain UIAppearanceDetailEvent -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"uidisappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder (\UIAppearanceDetailEvent
x model
_ DOMRef
_ -> UIAppearanceDetailEvent -> action
action UIAppearanceDetailEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onDisappearMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleDisappear UIAppearanceDetailEvent Model DOMRef
--
-- view_ [ event (static (onDisappearMainWith HandleDisappear)) ] [ "some view" ]
-- @
--
onDisappearMainWith :: (UIAppearanceDetailEvent -> model -> DOMRef -> action) -> EventHandler model action
onDisappearMainWith :: forall model action.
(UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
onDisappearMainWith UIAppearanceDetailEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder UIAppearanceDetailEvent
-> (UIAppearanceDetailEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"uidisappear" Decoder UIAppearanceDetailEvent
uiAppearanceDetailDecoder UIAppearanceDetailEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onAnimationStart', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view_ [ event (static (onAnimationStartMain HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationStartMain :: (AnimationEvent -> action) -> EventHandler model action
onAnimationStartMain :: forall action model.
(AnimationEvent -> action) -> EventHandler model action
onAnimationStartMain AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationstart" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onAnimationStartMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleAnimation AnimationEvent Model DOMRef
--
-- view_ [ event (static (onAnimationStartMainWith HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationStartMainWith :: (AnimationEvent -> model -> DOMRef -> action) -> EventHandler model action
onAnimationStartMainWith :: forall model action.
(AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
onAnimationStartMainWith AnimationEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationstart" Decoder AnimationEvent
animationDecoder AnimationEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onAnimationEnd', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view_ [ event (static (onAnimationEndMain HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationEndMain :: (AnimationEvent -> action) -> EventHandler model action
onAnimationEndMain :: forall action model.
(AnimationEvent -> action) -> EventHandler model action
onAnimationEndMain AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationend" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onAnimationEndMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleAnimation AnimationEvent Model DOMRef
--
-- view_ [ event (static (onAnimationEndMainWith HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationEndMainWith :: (AnimationEvent -> model -> DOMRef -> action) -> EventHandler model action
onAnimationEndMainWith :: forall model action.
(AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
onAnimationEndMainWith AnimationEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationend" Decoder AnimationEvent
animationDecoder AnimationEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onAnimationCancel', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view_ [ event (static (onAnimationCancelMain HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationCancelMain :: (AnimationEvent -> action) -> EventHandler model action
onAnimationCancelMain :: forall action model.
(AnimationEvent -> action) -> EventHandler model action
onAnimationCancelMain AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationcancel" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onAnimationCancelMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleAnimation AnimationEvent Model DOMRef
--
-- view_ [ event (static (onAnimationCancelMainWith HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationCancelMainWith :: (AnimationEvent -> model -> DOMRef -> action) -> EventHandler model action
onAnimationCancelMainWith :: forall model action.
(AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
onAnimationCancelMainWith AnimationEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationcancel" Decoder AnimationEvent
animationDecoder AnimationEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onAnimationIteration', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleAnimation AnimationEvent
--
-- view_ [ event (static (onAnimationIterationMain HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationIterationMain :: (AnimationEvent -> action) -> EventHandler model action
onAnimationIterationMain :: forall action model.
(AnimationEvent -> action) -> EventHandler model action
onAnimationIterationMain AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationiteration" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onAnimationIterationMain', but also receives read-only access to the
-- @model@ and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleAnimation AnimationEvent Model DOMRef
--
-- view_ [ event (static (onAnimationIterationMainWith HandleAnimation)) ] [ "some view" ]
-- @
--
onAnimationIterationMainWith :: (AnimationEvent -> model -> DOMRef -> action) -> EventHandler model action
onAnimationIterationMainWith :: forall model action.
(AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
onAnimationIterationMainWith AnimationEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"animationiteration" Decoder AnimationEvent
animationDecoder AnimationEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onTransitionStart', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTransition AnimationEvent
--
-- view_ [ event (static (onTransitionStartMain HandleTransition)) ] [ "some view" ]
-- @
--
onTransitionStartMain :: (AnimationEvent -> action) -> EventHandler model action
onTransitionStartMain :: forall action model.
(AnimationEvent -> action) -> EventHandler model action
onTransitionStartMain AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"transitionstart" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTransitionStartMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTransition AnimationEvent Model DOMRef
--
-- view_ [ event (static (onTransitionStartMainWith HandleTransition)) ] [ "some view" ]
-- @
--
onTransitionStartMainWith :: (AnimationEvent -> model -> DOMRef -> action) -> EventHandler model action
onTransitionStartMainWith :: forall model action.
(AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
onTransitionStartMainWith AnimationEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"transitionstart" Decoder AnimationEvent
animationDecoder AnimationEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onTransitionEnd', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTransition AnimationEvent
--
-- view_ [ event (static (onTransitionEndMain HandleTransition)) ] [ "some view" ]
-- @
--
onTransitionEndMain :: (AnimationEvent -> action) -> EventHandler model action
onTransitionEndMain :: forall action model.
(AnimationEvent -> action) -> EventHandler model action
onTransitionEndMain AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"transitionend" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTransitionEndMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTransition AnimationEvent Model DOMRef
--
-- view_ [ event (static (onTransitionEndMainWith HandleTransition)) ] [ "some view" ]
-- @
--
onTransitionEndMainWith :: (AnimationEvent -> model -> DOMRef -> action) -> EventHandler model action
onTransitionEndMainWith :: forall model action.
(AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
onTransitionEndMainWith AnimationEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"transitionend" Decoder AnimationEvent
animationDecoder AnimationEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------
-- | Like 'onTransitionCancel', but dispatched on the Lynx __main thread__ ('MTS').
--
-- @
-- data Action = HandleTransition AnimationEvent
--
-- view_ [ event (static (onTransitionCancelMain HandleTransition)) ] [ "some view" ]
-- @
--
onTransitionCancelMain :: (AnimationEvent -> action) -> EventHandler model action
onTransitionCancelMain :: forall action model.
(AnimationEvent -> action) -> EventHandler model action
onTransitionCancelMain AnimationEvent -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"transitioncancel" Decoder AnimationEvent
animationDecoder (\AnimationEvent
x model
_ DOMRef
_ -> AnimationEvent -> action
action AnimationEvent
x)
-----------------------------------------------------------------------------
-- | Like 'onTransitionCancelMain', but also receives read-only access to the @model@
-- and the target element's 'DOMRef' (for imperative MTS mutation).
--
-- @
-- data Action = HandleTransition AnimationEvent Model DOMRef
--
-- view_ [ event (static (onTransitionCancelMainWith HandleTransition)) ] [ "some view" ]
-- @
--
onTransitionCancelMainWith :: (AnimationEvent -> model -> DOMRef -> action) -> EventHandler model action
onTransitionCancelMainWith :: forall model action.
(AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
onTransitionCancelMainWith AnimationEvent -> model -> DOMRef -> action
action = MisoString
-> Decoder AnimationEvent
-> (AnimationEvent -> model -> DOMRef -> action)
-> EventHandler model action
forall result model action.
MisoString
-> Decoder result
-> (result -> model -> DOMRef -> action)
-> EventHandler model action
onMain MisoString
"transitioncancel" Decoder AnimationEvent
animationDecoder AnimationEvent -> model -> DOMRef -> action
action
-----------------------------------------------------------------------------