Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/Browser/Events.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ effect module Browser.Events where { subscription = MySub } exposing
( onAnimationFrame, onAnimationFrameDelta
, onKeyPress, onKeyDown, onKeyUp
, onClick, onMouseMove, onMouseDown, onMouseUp
, onTouchStart, onTouchEnd, onTouchCancel, onTouchMove
, onResize, onVisibilityChange, Visibility(..)
)

Expand Down Expand Up @@ -30,6 +31,10 @@ If there is something else you need, use [ports] to do it in JavaScript!
@docs onClick, onMouseMove, onMouseDown, onMouseUp


# Touchscreen

@docs onTouchStart, onTouchEnd, onTouchCancel, onTouchMove

# Window

@docs onResize, onVisibilityChange, Visibility
Expand Down Expand Up @@ -176,6 +181,33 @@ onMouseUp : Decode.Decoder msg -> Sub msg
onMouseUp =
on Document "mouseup"

-- TOUCHSCREEN

{-| Subscribe to touch start events anywhere on screen.
-}
onTouchStart : Decode.Decoder msg -> Sub msg
onTouchStart =
on Document "touchstart"


{-| Subscribe to touch end events anywhere on screen.
-}
onTouchEnd : Decode.Decoder msg -> Sub msg
onTouchEnd =
on Document "touchend"

{-| Subscribe to touch cancel events anywhere on screen.
-}
onTouchCancel : Decode.Decoder msg -> Sub msg
onTouchCancel =
on Document "touchcancel"

{-| Subscribe to touch movement events anywhere on screen.
-}
onTouchMove : Decode.Decoder msg -> Sub msg
onTouchMove =
on Document "touchmove"



-- WINDOW
Expand Down