miso-lynx
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Lynx.Element.View.Event

Description

 
Synopsis

Events

onTouchStart :: (TouchEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#touchstart

It belongs to touch event, which is triggered when the finger starts to touch the touch surface.

@ data Action = HandleTouch TouchEvent

view model = view_ [ onTouchStart HandleTouch ]

update :: Action -> Effect Model Action update (HandleTouch TouchEvent {..}) = do io_ (consoleLog "touch event received")

onTouchMove :: (TouchEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#touchmove

It belongs to touch event, which is triggered when the finger moves on the touch surface.

data Action = HandleTouch TouchEvent

view :: Model -> View Action
view model = view_ [ onTouchMove HandleTouch ]

update :: Action -> Effect Model Action
update (HandleTouch TouchEvent {..}) = do
  io_ (consoleLog "touch event received")

onTouchEnd :: (TouchEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#touchend

It belongs to touch event, which is triggered when the finger leaves the touch surface.

data Action = HandleTouch TouchEvent

view :: Model -> View Action
view model = view_ [ onTouchEnd HandleTouch ]

update :: Action -> Effect Model Action
update (HandleTouch TouchEvent {..}) = do
  io_ (consoleLog "touch event received")

onTouchCancel :: (TouchEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#touchcancel

It belongs to touch event, which is triggered when the touch event, is interrupted by the system or Lynx external gesture.

data Action = HandleTouch TouchEvent

view :: Model -> View Action
view model = view_ [ onTouchCancel HandleTouch ]

update :: Action -> Effect Model Action
update (HandleTouch TouchEvent {..}) = do
  io_ (consoleLog "touch event received")

onTap :: action -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#tap

It belongs to touch event, which is triggered when the finger clicks on the touch surface.

data Action = HandleTap

view :: Model -> View Action
view model = view_ [ onTap HandleTap ]

update :: Action -> Effect Model Action
update HandleTap = do
  io_ (consoleLog "touch event received")

onLongPress :: (TouchEvent -> action) -> Attribute action Source #

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 :: Model -> View Action
view model = view_ [ onLongPress HandleTouch ]

update :: Action -> Effect Model Action
update (HandleTouch TouchEvent {..}) = do
  io_ (consoleLog "touch event received")

onLayoutChange :: (LayoutChangeDetailEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#layoutchange

It belongs to a custom event, 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 :: Model -> View Action
view model = view_ [ onLayoutChange HandleLayout ]

update :: Action -> Effect Model Action
update (HandleLayout LayoutChangeDetailEvent {..}) = do
  io_ (consoleLog "layout changed")

onAppear :: (UIAppearanceDetailEvent -> action) -> Attribute action Source #

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 :: Model -> View Action
view model = view_ [ onAppear HandleUI ]

update :: Action -> Effect Model Action
update (HandleUI UIAppearanceDetailEvent {..}) = do
  io_ (consoleLog "appearance detail event received")

onDisappear :: (UIAppearanceDetailEvent -> action) -> Attribute action Source #

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 :: Model -> View Action
view model = view_ [ onDisappear HandleUI ]

update :: Action -> Effect Model Action
update (HandleUI UIAppearanceDetailEvent {..}) = do
  io_ (consoleLog "appearance detail event received")

onAnimationStart :: (AnimationEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#animationstart

It belongs to animation event, which is triggered when the Animation animation starts.

data Action = HandleAnimation AnimationEvent

view :: Model -> View Action
view model = view_ [ onAnimationStart HandleAnimation ]

update :: Action -> Effect Model Action
update (HandleAnimation AnimationEvent {..}) = do
  io_ (consoleLog "animation event received")

onAnimationEnd :: (AnimationEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#animationend

It belongs to animation event, which is triggered when the Animation animation ends.

data Action = HandleAnimation AnimationEvent

view :: Model -> View Action
view model = view_ [ onAnimationEnd HandleAnimation ]

update :: Action -> Effect Model Action
update (HandleAnimation AnimationEvent {..}) = do
  io_ (consoleLog "animation event received")

onAnimationCancel :: (AnimationEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#animationcancel

It belongs to animation event, which is triggered when the Animation animation cancels.

data Action = HandleAnimation AnimationEvent

view :: Model -> View Action
view model = view_ [ onAnimationCancel HandleAnimation ]

update :: Action -> Effect Model Action
update (HandleAnimation AnimationEvent {..}) = do
  io_ (consoleLog "animation event received")

onAnimationIteration :: (AnimationEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#animationiteration

It belongs to animation event, which is triggered when the Animation animation iterates.

data Action = HandleAnimation AnimationEvent

view :: Model -> View Action
view model = view_ [ onAnimationIteration HandleAnimation ]

update :: Action -> Effect Model Action
update (HandleAnimation AnimationEvent {..}) = do
  io_ (consoleLog "animation event received")

onTransitionStart :: (AnimationEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#transitionstart

It belongs to animation event, which is triggered when the Transition animation starts.

data Action = HandleTransition AnimationEvent

view :: Model -> View Action
view model = view_ [ onTransitionStart HandleTransition ]

update :: Action -> Effect Model Action
update (HandleTransition TransitionEvent {..}) = do
  io_ (consoleLog "transition event received")

onTransitionEnd :: (AnimationEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#transitionend

It belongs to animation event, which is triggered when the Transition animation ends.

data Action = HandleTransition AnimationEvent

view :: Model -> View Action
view model = view_ [ onTransitionEnd HandleTransition ]

update :: Action -> Effect Model Action
update (HandleTransition TransitionEvent {..}) = do
  io_ (consoleLog "transition event received")

onTransitionCancel :: (AnimationEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/view.html#transitioncancel

It belongs to animation event, which is triggered when the Transition animation cancels.

data Action = HandleTransition AnimationEvent

view :: Model -> View Action
view model = view_ [ onTransitionCancel HandleTransition ]

update :: Action -> Effect Model Action
update (HandleTransition TransitionEvent {..}) = do
  io_ (consoleLog "transition event received")

Types

data TouchEvent Source #

Constructors

TouchEvent 

Fields

  • identifier :: Double

    Unique identifier of the touch point, which remains unchanged during the same touch process

  • xy :: (Double, Double)

    The horizontal / vertical position of the touch point in the coordinate system of the element actually touched

  • page :: (Double, Double)

    The horizontal / vertical position of the touch point in the current LynxView coordinate system

  • client :: (Double, Double)

    The horizontal / vertical position of the touch point in the current window coordinate system

Instances

Instances details
Show TouchEvent Source # 
Instance details

Defined in Miso.Lynx.Element.View.Event

Eq TouchEvent Source # 
Instance details

Defined in Miso.Lynx.Element.View.Event

data AnimationEvent Source #

Constructors

AnimationEvent 

Fields

  • 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`.

  • 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.

  • newAnimator :: Bool

    Default value True

Decoders

touchDecoder :: Decoder TouchEvent Source #

Touch decoder for use with events like onTap

animationDecoder :: Decoder AnimationEvent Source #

Animation decoder for use with events like onAnimationStart

Event Map